From 845b8b36d11ff05972fa249747e81141a3f5c759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Mon, 6 Dec 2021 17:10:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/RpcJsonp.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/RpcJsonp.php b/src/RpcJsonp.php index 1966657..8bb5a7e 100644 --- a/src/RpcJsonp.php +++ b/src/RpcJsonp.php @@ -7,14 +7,15 @@ use Http\Handler\Handler; use Http\Handler\Router; use Http\Message\ServerRequest; use Kiri\Abstracts\Component; +use Kiri\Abstracts\Config; use Kiri\Consul\Agent; use Kiri\Context; use Kiri\Events\EventProvider; +use Kiri\Exception\ConfigException; use Kiri\Kiri; use Note\Inject; use Note\Note; use Psr\Container\ContainerExceptionInterface; -use Psr\Container\ContainerInterface; use Psr\Container\NotFoundExceptionInterface; use Psr\Http\Message\ServerRequestInterface; use ReflectionException; @@ -87,13 +88,15 @@ class RpcJsonp extends Component implements OnConnectInterface, OnReceiveInterfa /** * @param OnWorkerStart|OnTaskerStart $server + * @throws ConfigException */ public function consulWatches(OnWorkerStart|OnTaskerStart $server) { if ($server->workerId != 0) { return; } - Timer::tick(1000, static function ($timeId) { + $async_time = (int)Config::get('consul.async_time', 1000); + Timer::tick($async_time, static function ($timeId) { if (env('state', 'start') == 'exit') { Timer::clear($timeId); return;