From db0005f13672989857950dd279cba51c1813c142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 31 Aug 2020 15:07:37 +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 --- http-server/ServerManager.php | 4 ++-- system/Processes.php | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/http-server/ServerManager.php b/http-server/ServerManager.php index 856711dc..eb33d800 100644 --- a/http-server/ServerManager.php +++ b/http-server/ServerManager.php @@ -15,13 +15,13 @@ class ServerManager /** * @param $pool * @param $process - * @param $application * @param $workerId * @return mixed */ - public static function create($pool, $process, $application, $workerId) + public static function create($pool, $process, $workerId) { try { + $application = Snowflake::get(); if (is_string($process) && class_exists($process)) { return static::createProcess($process, $application, $pool, $workerId); } diff --git a/system/Processes.php b/system/Processes.php index 26985e2f..716e90ea 100644 --- a/system/Processes.php +++ b/system/Processes.php @@ -27,10 +27,9 @@ class Processes extends Component */ public function initCore() { - $application = Snowflake::get(); - $server = $application->set(Pool::class, new Pool($this->size(), SWOOLE_IPC_UNIXSOCK)); - $server->on('workerStart', function (Pool $pool, int $workerId) use ($application) { - ServerManager::create($pool, $this->processes[$workerId], $application, $workerId); + $server = new Pool($this->size(), SWOOLE_IPC_UNIXSOCK); + $server->on('workerStart', function (Pool $pool, int $workerId) { + ServerManager::create($pool, $this->processes[$workerId], $workerId); }); $server->on('workerStop', function (Pool $pool, int $workerId) { $event = Snowflake::get()->event;