From 4968136bfee7f489fd7e9d7ae9e4dd0fe4b7c3eb Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Mon, 19 Apr 2021 02:10:47 +0800 Subject: [PATCH] modify --- HttpServer/Events/OnWorkerStart.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/HttpServer/Events/OnWorkerStart.php b/HttpServer/Events/OnWorkerStart.php index 96181225..8e01f747 100644 --- a/HttpServer/Events/OnWorkerStart.php +++ b/HttpServer/Events/OnWorkerStart.php @@ -36,13 +36,12 @@ class OnWorkerStart extends Callback $annotation = Snowflake::app()->getAnnotation(); $annotation->setLoader(unserialize($content)); - - if ($worker_id < $server->setting['worker_num']) { - $this->onWorker($server, $annotation); + if ($worker_id < $server->setting['worker_num']) { + $this->onWorker($server, $annotation); } else { $this->onTask($server, $annotation); } - } + } /** @@ -66,7 +65,9 @@ class OnWorkerStart extends Callback { putenv('environmental=' . Snowflake::TASK); - $annotation->runtime(directory('app'),CONTROLLER_PATH); + $annotation->runtime(MODEL_PATH); + $annotation->runtime(CRONTAB_PATH); + $annotation->runtime(CLIENT_PATH); name($server->worker_pid, 'Task#' . $server->worker_id); @@ -86,7 +87,12 @@ class OnWorkerStart extends Callback try { name($server->worker_pid, 'Worker#' . $server->worker_id); - $annotation->runtime(directory('app')); + $annotation->runtime(CONTROLLER_PATH); + $annotation->runtime(SOCKET_PATH); + $annotation->runtime(MODEL_PATH); + $annotation->runtime(CRONTAB_PATH); + $annotation->runtime(CLIENT_PATH); + $annotation->runtime(TASK_PATH); Snowflake::setWorkerId($server->worker_pid); putenv('environmental=' . Snowflake::WORKER);