From 9473384c183c44c4e8c4f285432564478bee0787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Tue, 31 May 2022 11:02:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RpcManager.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/RpcManager.php b/RpcManager.php index 5b80d96..c4dc779 100644 --- a/RpcManager.php +++ b/RpcManager.php @@ -30,14 +30,12 @@ class RpcManager extends Component * @return void * @throws Exception */ - public function reRegister(string $serviceName): void + public function reRegister(): void { - $config = $this->_rpc[$serviceName] ?? []; - if (empty($config)) { - return; - } $service = Kiri::getDi()->get(Agent::class); + $config = Config::get("rpc.consul", null, true); + $info = $service->service->service_health($config['config']['ID']); if ($info->getStatusCode() == 200) { return; @@ -52,9 +50,7 @@ class RpcManager extends Component public function tick(): void { try { -// foreach ($this->_rpc as $name => $list) { -// $this->reRegister($name); -// } + $this->reRegister(); } catch (\Throwable $throwable) { $this->logger->error(error_trigger_format($throwable)); }