modify plugin name

This commit is contained in:
2022-06-17 12:27:33 +08:00
parent 7fdf83cd3a
commit f85d2aa0a2
3 changed files with 12 additions and 2 deletions
+7
View File
@@ -9,6 +9,7 @@ use Kiri\Di\ContainerInterface;
use Kiri\Exception\ConfigException;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Psr\Log\LoggerInterface;
use ReflectionException;
use Swoole\Server;
use Kiri\Server\ServerInterface;
@@ -36,11 +37,13 @@ class AsyncServer
* @param Config $config
* @param ContainerInterface $container
* @param EventDispatch $dispatch
* @param LoggerInterface $logger
* @param ProcessManager $processManager
*/
public function __construct(public Config $config,
public ContainerInterface $container,
public EventDispatch $dispatch,
public LoggerInterface $logger,
public ProcessManager $processManager)
{
}
@@ -96,6 +99,8 @@ class AsyncServer
$this->server->set($this->systemConfig($config, $daemon));
$this->logger->alert('Listen ' . $config->type . ' address ' . $config->host . '::' . $config->port);
$this->onEventListen($this->server, Config::get('server.events', []));
$this->onEventListen($this->server, $config->events);
@@ -137,6 +142,8 @@ class AsyncServer
throw new Exception('Listen port fail.' . swoole_last_error());
}
$this->logger->alert('Listen ' . $config->type . ' address ' . $config->host . '::' . $config->port);
$port->set($this->resetSettings($config->type, $config->settings));
$this->onEventListen($port, $config->getEvents());
+4 -1
View File
@@ -27,7 +27,7 @@ abstract class BaseProcess implements OnProcessInterface
protected bool $enable_coroutine = true;
public string $name = 'swoole process.';
public string $name = '';
/**
@@ -35,6 +35,9 @@ abstract class BaseProcess implements OnProcessInterface
*/
public function getName(): string
{
if (empty($this->name)) {
return uniqid('p.');
}
return $this->name;
}
+1 -1
View File
@@ -46,7 +46,7 @@ class ProcessManager
$system = sprintf('[%s].Custom Process', Config::get('id', 'system-service'));
$this->logger->debug($system . ' ' . $customProcess->getName() . ' start.');
$this->logger->alert($system . ' ' . $customProcess->getName() . ' start.');
if (Context::inCoroutine()) {
return [$customProcess, $this->resolve($customProcess, $system)];
}