Commit 23d10c3e authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Fetcher erhöhen ihre Anzahl nicht mehr selbstständig

parent 1cecd9b3
......@@ -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);
// 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
// In that case it should be safe to simply exit this job
if(((microtime(true) - $lastJob) ) > 300)
$mission = $mission[1];
// 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:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment