This commit is contained in:
2022-05-31 11:02:15 +08:00
parent 152049fdae
commit 9473384c18
+4 -8
View File
@@ -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));
}