Redis maint notif was disabled. ONLY FOR REDIS CLOUD

This commit is contained in:
febux 2026-09-06 17:56:36 +03:00
parent ec2bcc9402
commit dc653737e0

View file

@ -13,7 +13,17 @@ def get_redis_client(redis_url: str) -> Any:
Callers own the connection lifecycle. The api creates one client at startup
and stores it in app.state.redis.
Maintenance notifications are disabled: they are a Redis Cloud feature and
self-hosted/Valkey servers reject ``CLIENT MAINT_NOTIFICATIONS`` with an
``unknown subcommand`` error, spamming debug logs.
"""
from redis.asyncio import Redis as AsyncRedis
from redis.maint_notifications import MaintNotificationsConfig
return AsyncRedis.from_url(redis_url, decode_responses=True)
maint_config = MaintNotificationsConfig(enabled=False)
return AsyncRedis.from_url(
redis_url,
decode_responses=True,
maint_notifications_config=maint_config,
)