变更
This commit is contained in:
+4
-8
@@ -30,14 +30,12 @@ class RpcManager extends Component
|
|||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @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);
|
$service = Kiri::getDi()->get(Agent::class);
|
||||||
|
|
||||||
|
$config = Config::get("rpc.consul", null, true);
|
||||||
|
|
||||||
$info = $service->service->service_health($config['config']['ID']);
|
$info = $service->service->service_health($config['config']['ID']);
|
||||||
if ($info->getStatusCode() == 200) {
|
if ($info->getStatusCode() == 200) {
|
||||||
return;
|
return;
|
||||||
@@ -52,9 +50,7 @@ class RpcManager extends Component
|
|||||||
public function tick(): void
|
public function tick(): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
// foreach ($this->_rpc as $name => $list) {
|
$this->reRegister();
|
||||||
// $this->reRegister($name);
|
|
||||||
// }
|
|
||||||
} catch (\Throwable $throwable) {
|
} catch (\Throwable $throwable) {
|
||||||
$this->logger->error(error_trigger_format($throwable));
|
$this->logger->error(error_trigger_format($throwable));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user