summaryrefslogtreecommitdiff
path: root/searx/limiter.py
diff options
context:
space:
mode:
authorGaspard d'Hautefeuille <github@dhautefeuille.eu>2025-07-09 07:55:37 +0200
committerGitHub <noreply@github.com>2025-07-09 07:55:37 +0200
commitf798ddd4922d793d5e6ccb7c4111810d549ff4f4 (patch)
tree223aa9d26deb176d983cd8e1bed51ff2cff71eff /searx/limiter.py
parentbd593d0bad2189f57657bbcfa2c5e86f795c680e (diff)
[mod] migrate from Redis to Valkey (#4795)
This patch migrates from `redis==5.2.1` [1] to `valkey==6.1.0` [2]. The migration to valkey is necessary because the company behind Redis has decided to abandon the open source license. After experiencing a drop in user numbers, they now want to run it under a dual license again. But this move demonstrates once again how unreliable the company is and how it treats open source developers. To review first, read the docs:: $ make docs.live Follow the instructions to remove redis: - http://0.0.0.0:8000/admin/settings/settings_redis.html Config and install a local valkey DB: - http://0.0.0.0:8000/admin/settings/settings_valkey.html [1] https://pypi.org/project/redis/ [2] https://pypi.org/project/valkey/ Co-authored-by: HLFH <gaspard@dhautefeuille.eu> Co-authored-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/limiter.py')
-rw-r--r--searx/limiter.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/searx/limiter.py b/searx/limiter.py
index 92b38c68f..99bc338d1 100644
--- a/searx/limiter.py
+++ b/searx/limiter.py
@@ -17,7 +17,7 @@ from the :ref:`botdetection`:
the time.
- Detection & dynamically :ref:`botdetection rate limit` of bots based on the
- behavior of the requests. For dynamically changeable IP lists a Redis
+ behavior of the requests. For dynamically changeable IP lists a Valkey
database is needed.
The prerequisite for IP based methods is the correct determination of the IP of
@@ -50,13 +50,13 @@ To enable the limiter activate:
...
limiter: true # rate limit the number of request on the instance, block some bots
-and set the redis-url connection. Check the value, it depends on your redis DB
-(see :ref:`settings redis`), by example:
+and set the valkey-url connection. Check the value, it depends on your valkey DB
+(see :ref:`settings valkey`), by example:
.. code:: yaml
- redis:
- url: unix:///usr/local/searxng-redis/run/redis.sock?db=0
+ valkey:
+ url: valkey://localhost:6379/0
Configure Limiter
@@ -102,7 +102,7 @@ import werkzeug
from searx import (
logger,
- redisdb,
+ valkeydb,
)
from searx import botdetection
from searx.extended_types import SXNG_Request, sxng_request
@@ -217,7 +217,7 @@ def pre_request():
def is_installed():
- """Returns ``True`` if limiter is active and a redis DB is available."""
+ """Returns ``True`` if limiter is active and a valkey DB is available."""
return _INSTALLED
@@ -229,15 +229,15 @@ def initialize(app: flask.Flask, settings):
# (e.g. the self_info plugin uses the botdetection to get client IP)
cfg = get_cfg()
- redis_client = redisdb.client()
- botdetection.init(cfg, redis_client)
+ valkey_client = valkeydb.client()
+ botdetection.init(cfg, valkey_client)
if not (settings['server']['limiter'] or settings['server']['public_instance']):
return
- if not redis_client:
+ if not valkey_client:
logger.error(
- "The limiter requires Redis, please consult the documentation: "
+ "The limiter requires Valkey, please consult the documentation: "
"https://docs.searxng.org/admin/searx.limiter.html"
)
if settings['server']['public_instance']: