Skip to content
Snippets Groups Projects
Commit 51622b65 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Fehler in den Fetchern behoben, der erhöhte Ladezeiten verursacht haben könnte.

parent b0bf9211
No related branches found
No related tags found
1 merge request!1179Fehler in den Fetchern behoben, der erhöhte Ladezeiten verursacht haben könnte.
...@@ -15,7 +15,11 @@ class Searcher implements ShouldQueue ...@@ -15,7 +15,11 @@ class Searcher implements ShouldQueue
use InteractsWithQueue, Queueable, SerializesModels; use InteractsWithQueue, Queueable, SerializesModels;
protected $name, $ch, $pid, $counter, $lastTime, $connectionInfo; protected $name, $ch, $pid, $counter, $lastTime, $connectionInfo;
# Each Searcher will shutdown after a specified time(s) or number of requests
protected $MAX_REQUESTS = 100; protected $MAX_REQUESTS = 100;
# This value should always be below the retry_after value in config/queue.php
protected $MAX_TIME = 240;
protected $startTime = null;
protected $importantEngines = array("Fastbot", "overture", "overtureAds"); protected $importantEngines = array("Fastbot", "overture", "overtureAds");
protected $recheck; protected $recheck;
...@@ -35,6 +39,7 @@ class Searcher implements ShouldQueue ...@@ -35,6 +39,7 @@ class Searcher implements ShouldQueue
$this->name = $name; $this->name = $name;
$this->pid = getmypid(); $this->pid = getmypid();
$this->recheck = false; $this->recheck = false;
$this->startTime = microtime(true);
// Submit this worker to the Redis System // Submit this worker to the Redis System
Redis::expire($this->name, 5); Redis::expire($this->name, 5);
} }
...@@ -91,7 +96,9 @@ class Searcher implements ShouldQueue ...@@ -91,7 +96,9 @@ class Searcher implements ShouldQueue
// In sync mode every Searcher may only retrieve one result because it would block // In sync mode every Searcher may only retrieve one result because it would block
// the execution of the remaining code otherwise: // the execution of the remaining code otherwise:
if(getenv("QUEUE_DRIVER") === "sync" || $this->counter > $this->MAX_REQUESTS){ if(getenv("QUEUE_DRIVER") === "sync"
|| $this->counter > $this->MAX_REQUESTS
|| (microtime(true)-$this->startTime) > $this->MAX_TIME){
break; break;
} }
} }
......
...@@ -45,7 +45,7 @@ return [ ...@@ -45,7 +45,7 @@ return [
'driver' => 'beanstalkd', 'driver' => 'beanstalkd',
'host' => 'localhost', 'host' => 'localhost',
'queue' => 'default', 'queue' => 'default',
'retry_after' => 90, 'retry_after' => 90,
], ],
'sqs' => [ 'sqs' => [
...@@ -61,7 +61,7 @@ return [ ...@@ -61,7 +61,7 @@ return [
'driver' => 'redis', 'driver' => 'redis',
'connection' => 'default', 'connection' => 'default',
'queue' => 'default', 'queue' => 'default',
'retry_after' => 90, 'retry_after' => 300,
], ],
], ],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment