diff --git a/metager/app/Console/Commands/RequestFetcher.php b/metager/app/Console/Commands/RequestFetcher.php index 6b12321ed60afdbfdd772d7d0a5c33e6f71e9f6a..40c9eb31055a10e4fe2dfafcc7b0614e5e25106e 100644 --- a/metager/app/Console/Commands/RequestFetcher.php +++ b/metager/app/Console/Commands/RequestFetcher.php @@ -72,7 +72,7 @@ class RequestFetcher extends Command } try { - while ($this->shouldRun) { + while (true) { Redis::set(self::HEALTHCHECK_KEY, Carbon::now()->format(self::HEALTHCHECK_FORMAT)); $operationsRunning = true; curl_multi_exec($this->multicurl, $operationsRunning); @@ -84,6 +84,9 @@ class RequestFetcher extends Command if ($newJobs === 0 && $answersRead === 0) { usleep(10 * 1000); } + if (!$this->shouldRun && $operationsRunning === 0) { + break; + } } } finally { curl_multi_close($this->multicurl);