Commit 84b24a24 authored by Dominik Hebeler's avatar Dominik Hebeler

added more timings

parent a6e0ab4e
......@@ -61,14 +61,11 @@ class MetaGerSearch extends Controller
# Suche für alle zu verwendenden Suchmaschinen als Job erstellen,
# auf Ergebnisse warten und die Ergebnisse laden
$metager->createSearchEngines($request);
if (!empty($timings)) {
$timings["createSearchEngines"] = microtime(true) - $time;
}
$metager->createSearchEngines($request, $timings);
$metager->startSearch();
if (!empty($timings)) {
$timings["createSearchEngines"] = microtime(true) - $time;
$timings["startSearch"] = microtime(true) - $time;
}
$metager->waitForMainResults();
......
......@@ -473,8 +473,12 @@ class MetaGer
* Die Erstellung der Suchmaschinen bis die Ergebnisse da sind mit Unterfunktionen
*/
public function createSearchEngines(Request $request)
public function createSearchEngines(Request $request, &$timings)
{
if (!empty($timings)) {
$timings["createSearchEngines"]["start"] = microtime(true) - $timings["starttime"];
}
# Wenn es kein Suchwort gibt
if (!$request->filled("eingabe") || $this->q === "") {
return;
......@@ -495,8 +499,16 @@ class MetaGer
$sumas[$sumaName] = $this->sumaFile->sumas->{$sumaName};
}
if (!empty($timings)) {
$timings["createSearchEngines"]["created engine array"] = microtime(true) - $timings["starttime"];
}
$this->removeAdsFromListIfAdfree($sumas);
if (!empty($timings)) {
$timings["createSearchEngines"]["removed ads"] = microtime(true) - $timings["starttime"];
}
foreach ($sumas as $sumaName => $suma) {
# Check if this engine is disabled and can't be used
$disabled = empty($suma->disabled) ? false : $suma->disabled;
......@@ -550,6 +562,10 @@ class MetaGer
}
}
if (!empty($timings)) {
$timings["createSearchEngines"]["filtered invalid engines"] = microtime(true) - $timings["starttime"];
}
# Include Yahoo Ads if Yahoo is not enabled as a searchengine
if (!$this->apiAuthorized && $this->fokus != "bilder" && empty($this->enabledSearchengines["yahoo"]) && isset($this->sumaFile->sumas->{"yahoo-ads"})) {
$this->enabledSearchengines["yahoo-ads"] = $this->sumaFile->sumas->{"yahoo-ads"};
......@@ -574,6 +590,10 @@ class MetaGer
$this->errors[] = $error;
}
$this->setEngines($request);
if (!empty($timings)) {
$timings["createSearchEngines"]["saved engines"] = microtime(true) - $timings["starttime"];
}
}
private function removeAdsFromListIfAdfree(&$sumas)
......
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