diff --git a/Abstracts/TraitServer.php b/Abstracts/TraitServer.php index 6932a49..1e2513f 100644 --- a/Abstracts/TraitServer.php +++ b/Abstracts/TraitServer.php @@ -2,7 +2,6 @@ namespace Kiri\Server\Abstracts; -use Kiri\Exception\ConfigException; use Swoole\Http\Server as HServer; use Swoole\Server; use Kiri\Server\Constant; @@ -19,11 +18,12 @@ trait TraitServer /** * @param array $class * @return void - * @throws ConfigException */ public function addProcess(array $class): void { - $this->processManager->batch($class); + foreach ($class as $item) { + $this->_process[] = $item; + } } diff --git a/Server.php b/Server.php index 0d1c179..8d15b3d 100644 --- a/Server.php +++ b/Server.php @@ -115,13 +115,14 @@ class Server extends HttpService */ public function start(): void { + $this->manager->addProcess($this->process); $this->manager->initCoreServers(Config::get('server', [], true), $this->daemon); $this->manager->onSignal(Config::get('signal', [])); $this->onHotReload(); - $this->manager->addProcess($this->process); + $this->dispatch->dispatch(new OnServerBeforeStart()); $this->manager->start(); }