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