fix: retry Valkey once on a dropped connection
The client passed the sync redis.retry.Retry to async connections, so no retry could ever run. Use redis.asyncio.retry.Retry with one immediate retry on ConnectionError only: after a Valkey restart the stale pooled connection is reopened instead of switching the cache off for 5 s. Timeouts are not retried, and asyncio.timeout bounds each cache command (pool wait, connect, retry, reply) by [cache] timeout_seconds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+2
-1
@@ -35,7 +35,8 @@ kdf_concurrency = 4
|
||||
[cache]
|
||||
# Адрес, порт и пароль Valkey приходят из .env (мосты к VALKEY_*) и из
|
||||
# environment compose; здесь их не указывать.
|
||||
# секунды на соединение и ответ Valkey; дольше — запрос идёт в PostgreSQL
|
||||
# секунды на всю команду Valkey (ожидание пула, соединение, ответ);
|
||||
# дольше — запрос идёт в PostgreSQL
|
||||
timeout_seconds = 0.2
|
||||
# секунды, на которые кэш пропускается после отказа Valkey
|
||||
retry_after_seconds = 5
|
||||
|
||||
Reference in New Issue
Block a user