From 64fd34a23c650aee3645fa21517cfa031f8966a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Mon, 11 Jul 2022 16:09:57 +0800 Subject: [PATCH] modify plugin name --- DatabasesProviders.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/DatabasesProviders.php b/DatabasesProviders.php index fbcfb0c..329a8dd 100644 --- a/DatabasesProviders.php +++ b/DatabasesProviders.php @@ -14,9 +14,13 @@ use Kiri\Events\EventProvider; use Kiri\Annotation\Inject; use Kiri\Server\Events\OnWorkerStart; use Kiri\Server\Events\OnTaskerStart; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; use Psr\Log\LoggerInterface; use Kiri\Server\Events\OnWorkerExit; use Swoole\Timer; +use Kiri\Server\WorkerStatus; +use Kiri\Server\Abstracts\StatusEnum; use Kiri\Di\LocalService; /** @@ -96,6 +100,8 @@ class DatabasesProviders extends Providers /** * @return void * @throws ConfigException + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface */ public function filter(): void { @@ -107,8 +113,10 @@ class DatabasesProviders extends Providers } $const = 'Worker %d db client has %d, valid %d'; $logger->alert(sprintf($const, env('environmental_workerId'), $count, $valid)); - - Timer::after(10000, [$this, 'filter']); + if ($this->container->get(WorkerStatus::class)->is(StatusEnum::EXIT)) { + return; + } + Timer::after(10000, [$this, 'filter']); }