This commit is contained in:
as2252258@163.com
2021-02-27 05:14:16 +08:00
parent 3f7651c5b5
commit b4a506ab91
+3
View File
@@ -15,6 +15,7 @@ use Snowflake\Process\Process;
use Snowflake\Snowflake; use Snowflake\Snowflake;
use Swoole\Coroutine; use Swoole\Coroutine;
use Swoole\Server; use Swoole\Server;
use Swoole\Timer;
/** /**
* Class OnWorkerStart * Class OnWorkerStart
@@ -70,6 +71,8 @@ class OnWorkerStart extends Callback
{ {
Coroutine\go(function (Server $server, $worker_id) { Coroutine\go(function (Server $server, $worker_id) {
$sigkill = Coroutine::waitSignal(SIGTERM | SIGKILL | SIGUSR2 | SIGUSR1); $sigkill = Coroutine::waitSignal(SIGTERM | SIGKILL | SIGUSR2 | SIGUSR1);
Timer::clearAll();
if ($sigkill === false) { if ($sigkill === false) {
do { do {
$number = Co::stats()['coroutine_num']; $number = Co::stats()['coroutine_num'];