SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.
Python bingbravedegoogleduckduckgogooglemetasearchprivacypythonqwantsearchsearch-enginesearxsearxngstartpageyahoo
[fix] checker: fix engine statistics
Alexandre Flamentd473407ec971
diff --git a/searx/metrology/error_recorder.py b/searx/metrology/error_recorder.pyindex bd8404ad1..f533e4e8b 100644--- a/searx/metrology/error_recorder.py+++ b/searx/metrology/error_recorder.py@@ -53,9 +53,9 @@ def add_error_context(engine_name: str, error_context: ErrorContext) -> None:def get_trace(traces):for trace in reversed(traces):split_filename = trace.filename.split('/')- if len(split_filename) > 3 and '/'.join(split_filename[-3:-1]) == 'searx/engines':+ if '/'.join(split_filename[-3:-1]) == 'searx/engines':return trace- if len(split_filename) > 3 and '/'.join(split_filename[-4:-1]) == 'searx/search/processors':+ if '/'.join(split_filename[-4:-1]) == 'searx/search/processors':return tracereturn traces[-1]diff --git a/searx/search/checker/impl.py b/searx/search/checker/impl.pyindex 71a941f73..244536f1b 100644--- a/searx/search/checker/impl.py+++ b/searx/search/checker/impl.py@@ -4,6 +4,7 @@ import typingimport typesimport functoolsimport itertools+import threadingfrom time import timefrom urllib.parse import urlparse@@ -377,6 +378,8 @@ class Checker:engineref_category = search_query.engineref_list[0].categoryparams = self.processor.get_params(search_query, engineref_category)if params is not None:+ with threading.RLock():+ self.processor.engine.stats['sent_search_count'] += 1self.processor.search(search_query.query, params, result_container, time(), 5)return result_containerdiff --git a/searx/search/processors/abstract.py b/searx/search/processors/abstract.pyindex eb8d296ec..3a853d49e 100644--- a/searx/search/processors/abstract.py+++ b/searx/search/processors/abstract.py@@ -1,13 +1,13 @@# SPDX-License-Identifier: AGPL-3.0-or-later-from abc import abstractmethod+from abc import abstractmethod, ABCfrom searx import loggerlogger = logger.getChild('searx.search.processor')-class EngineProcessor:+class EngineProcessor(ABC):def __init__(self, engine, engine_name):self.engine = engine