This commit is contained in:
2021-02-26 19:53:28 +08:00
parent cd3ed6937c
commit 6e3ecce453
4 changed files with 46 additions and 7 deletions
+4 -6
View File
@@ -22,6 +22,9 @@ class OnWorkerStart extends Callback
{
private int $_taskTable = 0;
/**
* @param Server $server
* @param int $worker_id
@@ -54,7 +57,6 @@ class OnWorkerStart extends Callback
* @param Server $server
* @param int $workerId
* 异步任务管制
* @throws ComponentException
*/
public function onTaskSignal(Server $server, int $workerId)
{
@@ -63,11 +65,7 @@ class OnWorkerStart extends Callback
if ($sigkill === false) {
return $server->stop($workerId);
}
$this->error(env('workerId') . '::' . $server->getWorkerStatus($workerId));
$this->error(env('workerId') . '::' . $server->stats()['coroutine_num']);
while ($server->getWorkerStatus($workerId) === SWOOLE_WORKER_BUSY) {
while (Snowflake::app()->isRun()) {
Coroutine::sleep(0.01);
}
return $server->stop($workerId);