From 9067eac4ca14c5a75203ee54068598b8ec02b3a8 Mon Sep 17 00:00:00 2001 From: Sihyeon Jang Date: Wed, 16 Jul 2025 09:16:11 +0900 Subject: [PATCH] chore: add log for redis.exceptions Signed-off-by: Sihyeon Jang --- backend/open_webui/utils/redis.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/backend/open_webui/utils/redis.py b/backend/open_webui/utils/redis.py index 111a8111e8..ca450028b0 100644 --- a/backend/open_webui/utils/redis.py +++ b/backend/open_webui/utils/redis.py @@ -1,10 +1,14 @@ import inspect from urllib.parse import urlparse +import logging + import redis from open_webui.env import REDIS_SENTINEL_MAX_RETRY_COUNT +log = logging.getLogger(__name__) + class SentinelRedisProxy: def __init__(self, sentinel, service, *, async_mode: bool = True, **kw): @@ -42,7 +46,18 @@ class SentinelRedisProxy: redis.exceptions.ReadOnlyError, ) as e: if i < REDIS_SENTINEL_MAX_RETRY_COUNT - 1: + log.debug( + "Redis sentinel fail-over (%s). Retry %s/%s", + type(e).__name__, + i + 1, + REDIS_SENTINEL_MAX_RETRY_COUNT, + ) continue + log.error( + "Redis operation failed after %s retries: %s", + REDIS_SENTINEL_MAX_RETRY_COUNT, + e, + ) raise e from e return _wrapped @@ -59,7 +74,18 @@ class SentinelRedisProxy: redis.exceptions.ReadOnlyError, ) as e: if i < REDIS_SENTINEL_MAX_RETRY_COUNT - 1: + log.debug( + "Redis sentinel fail-over (%s). Retry %s/%s", + type(e).__name__, + i + 1, + REDIS_SENTINEL_MAX_RETRY_COUNT, + ) continue + log.error( + "Redis operation failed after %s retries: %s", + REDIS_SENTINEL_MAX_RETRY_COUNT, + e, + ) raise e from e return _wrapped