From f272d8e451276ff7e8446499c2ab73f2f45a68df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Mon, 14 Feb 2022 11:31:25 +0800 Subject: [PATCH] modify plugin name --- ProcessManager.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ProcessManager.php b/ProcessManager.php index 8f4813a..478f8ac 100644 --- a/ProcessManager.php +++ b/ProcessManager.php @@ -39,7 +39,6 @@ class ProcessManager */ public function add(string|OnProcessInterface|BaseProcess $customProcess, string $tag = 'default') { - $server = Kiri::getDi()->get(SwooleServerInterface::class); if (is_string($customProcess)) { $customProcess = Kiri::getDi()->get($customProcess); } @@ -48,9 +47,11 @@ class ProcessManager $this->logger->debug($system . ' ' . $customProcess->getName() . ' start.'); $process = $this->parse($customProcess, $system); - if (Context::inCoroutine()) { + if (!Kiri::getDi()->has(SwooleServerInterface::class)) { $process->start(); } else { + $server = Kiri::getDi()->get(SwooleServerInterface::class); + $server->addProcess($process = $this->parse($customProcess, $system)); } $this->_process[$tag][$customProcess->getName()] = $process;