From 395be286f8598585a92855e52a5f4f36924a00ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Thu, 5 Aug 2021 17:06:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/Worker/OnServerWorker.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Server/Worker/OnServerWorker.php b/Server/Worker/OnServerWorker.php index e4b7235c..7ef9a14c 100644 --- a/Server/Worker/OnServerWorker.php +++ b/Server/Worker/OnServerWorker.php @@ -46,31 +46,28 @@ class OnServerWorker extends \Server\Abstracts\Server { $this->_setConfigCache($workerId); $annotation = Snowflake::app()->getAnnotation(); - $annotation->read(APP_PATH . 'app'); + $annotation->read(APP_PATH . 'app', 'App', + $workerId < $server->setting['worker_num'] ? [] : [CONTROLLER_PATH] + ); $this->eventDispatch->dispatch(new OnWorkerStart($server, $workerId)); $this->runEvent(Constant::WORKER_START, null, [$server, $workerId]); $this->workerInitExecutor($server, $annotation, $workerId); - $this->interpretDirectory($server, $annotation, $workerId); + $this->interpretDirectory($annotation); } /** - * @param Server $server * @param Annotation $annotation - * @param $workerId * @throws NotFindClassException * @throws ReflectionException * @throws Exception */ - private function interpretDirectory(Server $server, Annotation $annotation, $workerId) + private function interpretDirectory(Annotation $annotation) { - $fileLists = $annotation->runtime(APP_PATH . 'app', - $workerId < $server->setting['worker_num'] ? [] : [CONTROLLER_PATH] - ); - + $fileLists = $annotation->runtime(APP_PATH . 'app'); $di = Snowflake::getDi(); foreach ($fileLists as $class) { $instance = $di->get($class);