This commit is contained in:
as2252258@163.com
2021-02-27 02:55:34 +08:00
parent 434c5cf7d1
commit 22106cfcdc
+6 -2
View File
@@ -61,14 +61,18 @@ class OnWorkerStart extends Callback
public function onTaskSignal(Server $server, int $workerId)
{
go(function () use ($server, $workerId) {
$sigkill = Coroutine::waitSignal( SIGKILL | SIGUSR2 | SIGUSR1, -1);
try {
$sigkill = Coroutine::waitSignal(SIGKILL | SIGUSR1, -1);
if ($sigkill !== false) {
while (Snowflake::app()->isRun()) {
sleep(1);
Coroutine::sleep(1);
}
}
Snowflake::app()->stateInit();
$server->stop();
} catch (\Throwable $exception) {
$this->addError($exception);
}
});
}