From fe419e355bf1527c51e3aee98495d08b89510320 Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Fri, 15 Jul 2022 18:38:32 +0200 Subject: The checker requires Redis Remove the abstraction in searx.shared.SharedDict. Implement a basic and dedicated scheduler for the checker using a Redis script. --- searx/shared/__init__.py | 41 ++++------------------------------------- 1 file changed, 4 insertions(+), 37 deletions(-) (limited to 'searx/shared/__init__.py') diff --git a/searx/shared/__init__.py b/searx/shared/__init__.py index d10ddb33d..2c7fc9f8b 100644 --- a/searx/shared/__init__.py +++ b/searx/shared/__init__.py @@ -1,39 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later +# lint: pylint +"""Initialization of a *shared* storage. +""" -import logging -import importlib - -logger = logging.getLogger('searx.shared') - -__all__ = ['SharedDict', 'schedule'] - -try: - uwsgi = importlib.import_module('uwsgi') -except: - # no uwsgi - from .shared_simple import SimpleSharedDict as SharedDict, schedule - - logger.info('Use shared_simple implementation') -else: - try: - uwsgi.cache_update('dummy', b'dummy') - if uwsgi.cache_get('dummy') != b'dummy': - raise Exception() - except: - # uwsgi.ini configuration problem: disable all scheduling - logger.error( - 'uwsgi.ini configuration error, add this line to your uwsgi.ini\n' - 'cache2 = name=searxngcache,items=2000,blocks=2000,blocksize=4096,bitmap=1' - ) - from .shared_simple import SimpleSharedDict as SharedDict - - def schedule(delay, func, *args): - return False - - else: - # uwsgi - from .shared_uwsgi import UwsgiCacheSharedDict as SharedDict, schedule - - logger.info('Use shared_uwsgi implementation') - -storage = SharedDict() +from . import redisdb -- cgit v1.2.3