变更
This commit is contained in:
+10
-6
@@ -91,16 +91,20 @@ class RpcJsonp extends Component implements OnConnectInterface, OnReceiveInterfa
|
|||||||
* @param OnBeforeShutdown $beforeShutdown
|
* @param OnBeforeShutdown $beforeShutdown
|
||||||
* @return void
|
* @return void
|
||||||
* @throws ContainerExceptionInterface
|
* @throws ContainerExceptionInterface
|
||||||
* @throws NotFoundExceptionInterface
|
* @throws NotFoundExceptionInterface|ConfigException
|
||||||
*/
|
*/
|
||||||
public function onBeforeShutdown(OnBeforeShutdown $beforeShutdown): void
|
public function onBeforeShutdown(OnBeforeShutdown $beforeShutdown): void
|
||||||
{
|
{
|
||||||
$doneList = $this->manager->doneList();
|
|
||||||
$agent = $this->container->get(Agent::class);
|
$agent = $this->container->get(Agent::class);
|
||||||
foreach ($doneList as $value) {
|
$value = Config::get("rpc.consul", []);
|
||||||
$agent->service->deregister($value['config']['ID']);
|
if (empty($value)) {
|
||||||
$agent->checks->deregister($value['config']['Check']['CheckId']);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->logger->debug("disconnect consul.");
|
||||||
|
|
||||||
|
$agent->service->deregister($value['ID']);
|
||||||
|
$agent->checks->deregister($value['Check']['CheckId']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user