From aae7830d14242ac1f98232f428654c5d2c9c5eb2 Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Tue, 13 Apr 2021 15:21:53 +0200 Subject: [mod] refactoring: processors Report to the user suspended engines. searx.search.processor.abstract: * manages suspend time (per network). * reports suspended time to the ResultContainer (method extend_container_if_suspended) * adds the results to the ResultContainer (method extend_container) * handles exceptions (method handle_exception) --- searx/search/checker/impl.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'searx/search/checker/impl.py') diff --git a/searx/search/checker/impl.py b/searx/search/checker/impl.py index e54b3f68d..1893a82b9 100644 --- a/searx/search/checker/impl.py +++ b/searx/search/checker/impl.py @@ -4,7 +4,6 @@ import typing import types import functools import itertools -import threading from time import time from urllib.parse import urlparse @@ -385,7 +384,7 @@ class Checker: engineref_category = search_query.engineref_list[0].category params = self.processor.get_params(search_query, engineref_category) if params is not None: - with threading.RLock(): + with self.processor.lock: self.processor.engine.stats['sent_search_count'] += 1 self.processor.search(search_query.query, params, result_container, time(), 5) return result_container -- cgit v1.2.3 From 7acd7ffc02d14d175ec2a99ba984e47d8cb65d7d Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Wed, 14 Apr 2021 17:23:15 +0200 Subject: [enh] rewrite and enhance metrics --- searx/search/checker/impl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'searx/search/checker/impl.py') diff --git a/searx/search/checker/impl.py b/searx/search/checker/impl.py index 1893a82b9..5cb289ec6 100644 --- a/searx/search/checker/impl.py +++ b/searx/search/checker/impl.py @@ -16,6 +16,7 @@ from searx import network, logger from searx.results import ResultContainer from searx.search.models import SearchQuery, EngineRef from searx.search.processors import EngineProcessor +from searx.metrics import counter_inc logger = logger.getChild('searx.search.checker') @@ -384,8 +385,7 @@ class Checker: engineref_category = search_query.engineref_list[0].category params = self.processor.get_params(search_query, engineref_category) if params is not None: - with self.processor.lock: - self.processor.engine.stats['sent_search_count'] += 1 + counter_inc('engine', search_query.engineref_list[0].name, 'search', 'count', 'sent') self.processor.search(search_query.query, params, result_container, time(), 5) return result_container -- cgit v1.2.3 From 7cfd8d900a9d828e5fbbcb5df65ffedbf11a5a0f Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Wed, 14 Apr 2021 18:11:35 +0200 Subject: [mod] oscar: /preferences , engines tab: report engine times * display the median time instead of the average. * add a "Reliability" column (sum up the metrics and the checker results). * the "selected language", "SafeSearch", "Time range" values are displayed as "broken" when the checker tests fail. --- searx/search/checker/impl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'searx/search/checker/impl.py') diff --git a/searx/search/checker/impl.py b/searx/search/checker/impl.py index 5cb289ec6..dd090c513 100644 --- a/searx/search/checker/impl.py +++ b/searx/search/checker/impl.py @@ -5,6 +5,7 @@ import types import functools import itertools from time import time +from timeit import default_timer from urllib.parse import urlparse import re @@ -386,7 +387,7 @@ class Checker: params = self.processor.get_params(search_query, engineref_category) if params is not None: counter_inc('engine', search_query.engineref_list[0].name, 'search', 'count', 'sent') - self.processor.search(search_query.query, params, result_container, time(), 5) + self.processor.search(search_query.query, params, result_container, default_timer(), 5) return result_container def get_result_container_tests(self, test_name: str, search_query: SearchQuery) -> ResultContainerTests: -- cgit v1.2.3