mirror of
https://github.com/searxng/searxng.git
synced 2026-01-03 01:20:02 +00:00
Merge pull request #1954 from dalf/fix.redis.init.2
[fix] follow up of PR-1856
This commit is contained in:
@@ -16,7 +16,7 @@ Enable the plugin in ``settings.yml``:
|
||||
import re
|
||||
from flask import request
|
||||
|
||||
from searx.shared import redisdb
|
||||
from searx import redisdb
|
||||
from searx.redislib import incr_sliding_window
|
||||
|
||||
name = "Request limiter"
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
This implementation uses the :ref:`settings redis` setup from ``settings.yml``.
|
||||
A redis DB connect can be tested by::
|
||||
|
||||
>>> from searx.shared import redisdb
|
||||
>>> redisdb.init()
|
||||
>>> from searx import redisdb
|
||||
>>> redisdb.initialize()
|
||||
True
|
||||
>>> db = redisdb.client()
|
||||
>>> db.set("foo", "bar")
|
||||
@@ -30,7 +30,7 @@ OLD_REDIS_URL_DEFAULT_URL = 'unix:///usr/local/searxng-redis/run/redis.sock?db=0
|
||||
"""This was the default Redis URL in settings.yml."""
|
||||
|
||||
_CLIENT = None
|
||||
logger = logging.getLogger('searx.shared.redisdb')
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def client() -> redis.Redis:
|
||||
@@ -14,7 +14,7 @@ from typing_extensions import TypedDict, Literal
|
||||
import redis.exceptions
|
||||
|
||||
from searx import logger, settings, searx_debug
|
||||
from searx.shared.redisdb import client as get_redis_client
|
||||
from searx.redisdb import client as get_redis_client
|
||||
from searx.exceptions import SearxSettingsException
|
||||
from searx.search.processors import PROCESSORS
|
||||
from searx.search.checker import Checker
|
||||
|
||||
@@ -17,7 +17,7 @@ import time
|
||||
import importlib
|
||||
from typing import Callable
|
||||
|
||||
from searx.shared.redisdb import client as get_redis_client
|
||||
from searx.redisdb import client as get_redis_client
|
||||
from searx.redislib import lua_script_storage
|
||||
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ SCHEMA = {
|
||||
'default_http_headers': SettingsValue(dict, {}),
|
||||
},
|
||||
'redis': {
|
||||
'url': SettingsValue((None, False, str), False),
|
||||
'url': SettingsValue((None, False, str), False, 'SEARXNG_REDIS_URL'),
|
||||
},
|
||||
'ui': {
|
||||
'static_path': SettingsDirectoryValue(str, os.path.join(searx_dir, 'static')),
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# lint: pylint
|
||||
"""Initialization of a *shared* storage.
|
||||
"""
|
||||
|
||||
from . import redisdb
|
||||
@@ -120,7 +120,7 @@ from searx.locales import (
|
||||
# renaming names from searx imports ...
|
||||
from searx.autocomplete import search_autocomplete, backends as autocomplete_backends
|
||||
from searx.languages import language_codes as languages
|
||||
from searx.shared.redisdb import initialize as redis_initialize
|
||||
from searx.redisdb import initialize as redis_initialize
|
||||
from searx.search import SearchWithPlugins, initialize as search_initialize
|
||||
from searx.network import stream as http_stream, set_context_network_name
|
||||
from searx.search.checker import get_result as checker_get_result
|
||||
|
||||
Reference in New Issue
Block a user