Skip to content

SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.

[fix] measure request duration only if total_time attribute is set - fixes autocompleter

Adam Tauber27e95846ead3
diff --git a/searx/poolrequests.py b/searx/poolrequests.py
index 933e0ad93..f9a9d7719 100644
--- a/searx/poolrequests.py
+++ b/searx/poolrequests.py
@@ -122,8 +122,8 @@ def request(method, url, **kwargs):
# session end
session.close()
- #
- threadLocal.total_time += time_after_request - time_before_request
+ if hasattr(threadLocal, 'total_time'):
+ threadLocal.total_time += time_after_request - time_before_request
return response