From 7a28085378d9f4ebc9b80f054e9138453847bc95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 3 Aug 2021 10:54:19 +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/ServerWorker.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Server/Worker/ServerWorker.php b/Server/Worker/ServerWorker.php index 2e31a036..227f0c5a 100644 --- a/Server/Worker/ServerWorker.php +++ b/Server/Worker/ServerWorker.php @@ -48,25 +48,26 @@ class ServerWorker extends \Server\Abstracts\Server } $this->workerInitExecutor($server, $annotation, $workerId); - $this->interpretDirectory($annotation); + $this->interpretDirectory($server, $annotation); $store->close(); } /** + * @param Server $server * @param Annotation $annotation - * @throws ReflectionException * @throws NotFindClassException + * @throws ReflectionException * @throws Exception */ - private function interpretDirectory(Annotation $annotation) + private function interpretDirectory(Server $server, Annotation $annotation) { $fileLists = $annotation->runtime(APP_PATH . 'app'); $di = Snowflake::getDi(); foreach ($fileLists as $file => $class) { - if (!Snowflake::isWorker() && str_contains($file, CONTROLLER_PATH)) { + if ($server->worker_id >= $server->setting['worker_num'] && str_contains($file, CONTROLLER_PATH)) { continue; } $instance = $di->get($class);