modify
This commit is contained in:
@@ -62,15 +62,12 @@ class OnWorkerStart extends Callback
|
|||||||
public function onTaskSignal(Server $server, int $workerId): mixed
|
public function onTaskSignal(Server $server, int $workerId): mixed
|
||||||
{
|
{
|
||||||
$sigkill = Coroutine::waitSignal(SIGTERM | SIGKILL | SIGUSR2 | SIGUSR1, -1);
|
$sigkill = Coroutine::waitSignal(SIGTERM | SIGKILL | SIGUSR2 | SIGUSR1, -1);
|
||||||
Coroutine\defer(function () {
|
if ($sigkill !== false) {
|
||||||
Snowflake::app()->stateInit();
|
|
||||||
});
|
|
||||||
if ($sigkill === false) {
|
|
||||||
return $server->stop($workerId);
|
|
||||||
}
|
|
||||||
while (Snowflake::app()->isRun()) {
|
while (Snowflake::app()->isRun()) {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Snowflake::app()->stateInit();
|
||||||
return $server->stop($workerId);
|
return $server->stop($workerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user