From 382a49da9fd6981d3277f83c9513c71d46a9a724 Mon Sep 17 00:00:00 2001 From: Deeka Wong Date: Mon, 28 Aug 2023 00:51:29 -0500 Subject: [PATCH] Fix the bug that cannot stop the command from terminating gracefully (#6090) --- src/Adapter/Prometheus/MetricFactory.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Adapter/Prometheus/MetricFactory.php b/src/Adapter/Prometheus/MetricFactory.php index 188c27c..a6ed66b 100644 --- a/src/Adapter/Prometheus/MetricFactory.php +++ b/src/Adapter/Prometheus/MetricFactory.php @@ -126,6 +126,10 @@ protected function scrapeHandle(): void } } + if (CoordinatorManager::until(Coord::WORKER_EXIT)->isClosing()) { + return; + } + $server = $this->factory->make($host, (int) $port); Coroutine::create(static function () use ($server) {