modify plugin name

This commit is contained in:
2022-02-15 17:25:14 +08:00
parent 81f3278dd7
commit e26e16ba26
2 changed files with 5 additions and 2 deletions
+1 -2
View File
@@ -36,7 +36,7 @@ class OnServerWorker extends \Kiri\Server\Abstracts\Server
*/ */
public function init() public function init()
{ {
$this->collector = Kiri::getDi()->get(Router::class); // $this->collector = Kiri::getDi()->get(Router::class);
} }
@@ -52,7 +52,6 @@ class OnServerWorker extends \Kiri\Server\Abstracts\Server
set_env('environmental_workerId', $workerId); set_env('environmental_workerId', $workerId);
if ($workerId < $server->setting['worker_num']) { if ($workerId < $server->setting['worker_num']) {
$this->setProcessName(sprintf('Worker[%d].%d', $server->worker_pid, $workerId)); $this->setProcessName(sprintf('Worker[%d].%d', $server->worker_pid, $workerId));
$this->collector->scan_build_route();
$dispatch->dispatch(new OnWorkerStart($server, $workerId)); $dispatch->dispatch(new OnWorkerStart($server, $workerId));
set_env('environmental', Kiri::WORKER); set_env('environmental', Kiri::WORKER);
} else { } else {
+4
View File
@@ -17,6 +17,7 @@ use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface; use Psr\Container\NotFoundExceptionInterface;
use ReflectionException; use ReflectionException;
use Swoole\Coroutine; use Swoole\Coroutine;
use Kiri\Message\Handler\Router;
defined('PID_PATH') or define('PID_PATH', APP_PATH . 'storage/server.pid'); defined('PID_PATH') or define('PID_PATH', APP_PATH . 'storage/server.pid');
@@ -81,6 +82,7 @@ class Server extends HttpService
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
* @throws ReflectionException * @throws ReflectionException
* @throws Exception
*/ */
public function start(): void public function start(): void
{ {
@@ -97,6 +99,8 @@ class Server extends HttpService
$this->getEventDispatch()->dispatch(new OnServerBeforeStart()); $this->getEventDispatch()->dispatch(new OnServerBeforeStart());
$this->getContainer()->get(Router::class)->scan_build_route();
$this->manager->start(); $this->manager->start();
} }