This commit is contained in:
2021-02-26 19:04:53 +08:00
parent 96b6717a1e
commit e0a51e783a
2 changed files with 2 additions and 10 deletions
-1
View File
@@ -79,7 +79,6 @@ class OnTask extends Callback
} }
$finish = $this->runTaskHandler($task->data); $finish = $this->runTaskHandler($task->data);
Coroutine::getContext()['isComplete'] = true;
if (!$finish) { if (!$finish) {
$finish = []; $finish = [];
} }
+2 -9
View File
@@ -63,15 +63,8 @@ class OnWorkerStart extends Callback
if ($sigkill === false) { if ($sigkill === false) {
return $server->stop($workerId); return $server->stop($workerId);
} }
while (true) { while ($server->stats()['coroutine_num'] > 0) {
$context = Coroutine::getContext(Coroutine::getPcid()); Coroutine::sleep(0.01);
if (!isset($context['isComplete'])) {
break;
}
$content = $context['isComplete'];
if ($content === true) {
break;
}
} }
return $server->stop($workerId); return $server->stop($workerId);
}); });