This commit is contained in:
2021-03-01 17:08:45 +08:00
parent 82becbac1d
commit 47dadb35b7
+14 -6
View File
@@ -88,7 +88,6 @@ class OnWorkerStart extends Callback
} }
/** /**
* @param $server * @param $server
* @param $worker_id * @param $worker_id
@@ -96,16 +95,25 @@ class OnWorkerStart extends Callback
*/ */
public function onSignal(Server $server, $worker_id): mixed public function onSignal(Server $server, $worker_id): mixed
{ {
while (Coroutine::waitSignal($this->signal)) { $ret = Coroutine::waitSignal($this->signal);
if (!Snowflake::app()->isRun()) { if ($ret === true) {
break; $this->ticker();
}
sleep(1);
} }
return $server->stop($worker_id); return $server->stop($worker_id);
} }
public function ticker()
{
if (!Snowflake::app()->isRun()) {
return;
}
sleep(1);
$this->ticker();
}
/** /**
* @param $socket * @param $socket
* @param $worker_id * @param $worker_id