modify plugin name

This commit is contained in:
2022-02-14 11:31:25 +08:00
parent fed145a43f
commit f272d8e451
+3 -2
View File
@@ -39,7 +39,6 @@ class ProcessManager
*/ */
public function add(string|OnProcessInterface|BaseProcess $customProcess, string $tag = 'default') public function add(string|OnProcessInterface|BaseProcess $customProcess, string $tag = 'default')
{ {
$server = Kiri::getDi()->get(SwooleServerInterface::class);
if (is_string($customProcess)) { if (is_string($customProcess)) {
$customProcess = Kiri::getDi()->get($customProcess); $customProcess = Kiri::getDi()->get($customProcess);
} }
@@ -48,9 +47,11 @@ class ProcessManager
$this->logger->debug($system . ' ' . $customProcess->getName() . ' start.'); $this->logger->debug($system . ' ' . $customProcess->getName() . ' start.');
$process = $this->parse($customProcess, $system); $process = $this->parse($customProcess, $system);
if (Context::inCoroutine()) { if (!Kiri::getDi()->has(SwooleServerInterface::class)) {
$process->start(); $process->start();
} else { } else {
$server = Kiri::getDi()->get(SwooleServerInterface::class);
$server->addProcess($process = $this->parse($customProcess, $system)); $server->addProcess($process = $this->parse($customProcess, $system));
} }
$this->_process[$tag][$customProcess->getName()] = $process; $this->_process[$tag][$customProcess->getName()] = $process;