From acdf9494f195f3f510b2a07e9bf8e9355c36db5e Mon Sep 17 00:00:00 2001 From: Dominik Pfennig <dominik@suma-ev.de> Date: Wed, 10 May 2017 14:09:04 +0200 Subject: [PATCH] Boost Knopf von der Startseite entfernt Weitere Bugfixes in den Fetchern --- app/Jobs/Searcher.php | 10 ++++------ app/Models/Searchengine.php | 2 ++ resources/views/index.blade.php | 2 -- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/Jobs/Searcher.php b/app/Jobs/Searcher.php index 8a1e87a86..ba00d6cf4 100644 --- a/app/Jobs/Searcher.php +++ b/app/Jobs/Searcher.php @@ -14,7 +14,7 @@ class Searcher implements ShouldQueue { use InteractsWithQueue, Queueable, SerializesModels; - protected $name, $ch, $pid, $counter, $lastTime; + protected $name, $ch, $pid, $counter, $lastTime, $connectionInfo; protected $MAX_REQUESTS = 100; protected $importantEngines = array("Fastbot", "overture", "overtureAds"); protected $recheck; @@ -64,9 +64,7 @@ class Searcher implements ShouldQueue $this->updateStats(microtime(true) - $time); $this->switchToRunning(); // The mission can be empty when blpop hit the timeout - if(empty($mission)){ - continue; - }else{ + if(!empty($mission)){ $mission = $mission[1]; $poptime = microtime(true) - $time; @@ -121,7 +119,7 @@ class Searcher implements ShouldQueue } } private function updateStats($poptime){ - $connectionInfo = base64_encode(json_encode(curl_getinfo($this->ch), true)); + $connectionInfo = base64_encode(json_encode($this->connectionInfo)); Redis::hset($this->name . ".stats", $this->pid, $connectionInfo . ";" . $poptime); } @@ -144,8 +142,8 @@ class Searcher implements ShouldQueue private function retrieveUrl($url){ // Set this URL to the Curl handle curl_setopt($this->ch, CURLOPT_URL, $url); - $result = curl_exec($this->ch); + $this->connectionInfo = curl_getinfo($this->ch); return $result; } diff --git a/app/Models/Searchengine.php b/app/Models/Searchengine.php index 6f6cf9ba7..488bfd18f 100644 --- a/app/Models/Searchengine.php +++ b/app/Models/Searchengine.php @@ -155,6 +155,7 @@ abstract class Searchengine // of course need to spawn a new one. if(sizeof($searcherData) === 0){ $needSearcher = true; + Log::info("Request new Searcher beacause none is running"); }else{ // There we go: // There's at least one Fetcher running for this search engine. @@ -170,6 +171,7 @@ abstract class Searchengine $median /= sizeof($searcherData); if($median < .1){ $needSearcher = true; + Log::info("Requesting new Searcher because: $median \n" . print_r($searcherData, true)); } } if($needSearcher && Redis::get($this->name) !== "locked"){ diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php index 955e744da..cb322c778 100644 --- a/resources/views/index.blade.php +++ b/resources/views/index.blade.php @@ -304,8 +304,6 @@ </form> </fieldset> <ul class="list-inline searchform-bonus"> - <li><a href="https://www.boost-project.com/de/shops?charity_id=1129&tag=bl" target="_blank" rel="noopener" id="foerdershops" class="btn btn-default mutelink" title="{{ trans('index.partnertitle') }}"><i class="fa fa-shopping-bag" aria-hidden="true"></i> {{ trans('index.conveyor') }}</a></li> - <li class="hidden-xs seperator">|</li> <li id="plug" @unless ($browser === 'Firefox' || $browser === 'Mozilla' || $browser === 'Chrome' || $browser === 'Opera' || $browser === 'IE' || $browser === 'Edge' || $browser === 'Safari' || $browser === 'Vivaldi') class="hidden" -- GitLab