This commit is contained in:
as2252258@163.com
2021-02-27 04:17:24 +08:00
parent f9d0307ecf
commit c83a98b50c
+3 -4
View File
@@ -41,7 +41,9 @@ class OnWorkerStart extends Callback
if (!empty($get_name) && !Snowflake::isMac()) {
swoole_set_process_name($get_name);
}
Coroutine\go(function () use ($server) {
Coroutine::waitPid($server->worker_pid);
});
$this->debug(sprintf('Worker #%d is start.....', $worker_id));
putenv('workerId=' . ($worker_id >= $server->setting['worker_num'] ? 'Task' : 'Worker') . '.' . $worker_id);
if ($worker_id >= $server->setting['worker_num']) {
@@ -49,9 +51,6 @@ class OnWorkerStart extends Callback
Coroutine\go(function () use ($server, $worker_id) {
$this->onTaskSignal($server, $worker_id);
});
Coroutine\go(function () use ($server) {
Coroutine::waitPid($server->worker_pid);
});
} else {
Snowflake::setWorkerId($server->worker_pid);
$this->setWorkerAction($worker_id);