From 23d10c3e75122a86381a71f51b8343d0a7464d9f Mon Sep 17 00:00:00 2001 From: Dominik Pfennig <dominik@suma-ev.de> Date: Fri, 5 May 2017 15:53:14 +0200 Subject: [PATCH] =?UTF-8?q?Fetcher=20erh=C3=B6hen=20ihre=20Anzahl=20nicht?= =?UTF-8?q?=20mehr=20selbstst=C3=A4ndig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Jobs/Searcher.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Jobs/Searcher.php b/app/Jobs/Searcher.php index f4bbbd7d4..dc836a2e2 100644 --- a/app/Jobs/Searcher.php +++ b/app/Jobs/Searcher.php @@ -46,6 +46,7 @@ class Searcher implements ShouldQueue // This Searches is freshly called so we need to initialize the curl handle $ch $this->ch = $this->initCurlHandle(); $this->counter = 0; // Counts the number of answered jobs + $lastJob = microtime(true); while(true){ // Update the expire Redis::expire($this->name, 5); @@ -59,15 +60,14 @@ class Searcher implements ShouldQueue // The mission can be empty when blpop hit the timeout if(empty($mission)){ // In that case it should be safe to simply exit this job - break; + if(((microtime(true) - $lastJob) ) > 300) + break; + else + continue; }else{ $mission = $mission[1]; $this->counter++; - // A running Searcher checks whether more of it are needed to properly work on the - // Queue without delay - if(getenv("QUEUE_DRIVER") !== "sync" && intval(Redis::llen($this->name . ".queue")) > 1){ - $this->dispatch(new Searcher($this->name)); - } + $lastJob = microtime(true); } // The mission is a String which can be divided to retrieve two informations: -- GitLab