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] redis: don't create a new connection at each client() call
Markus Heiserdca83944b588
diff --git a/searx/shared/redisdb.py b/searx/shared/redisdb.pyindex 613b82a38..da71d169c 100644--- a/searx/shared/redisdb.py+++ b/searx/shared/redisdb.py@@ -24,10 +24,16 @@ import redisfrom searx import get_settinglogger = logging.getLogger('searx.shared.redis')+_client = Nonedef client():- return redis.Redis.from_url(get_setting('redis.url'))+ global _client # pylint: disable=global-statement+ if _client is None:+ # not thread safe: in the worst case scenario, two or more clients are+ # initialized only one is kept, the others are garbage collected.+ _client = redis.Redis.from_url(get_setting('redis.url'))+ return _clientdef init():