fix(redis): use await asyncio.sleep() instead of time.sleep() in async generator (#25823)
time.sleep() inside the _wrap_async_gen() async generator blocks the entire event loop during Sentinel failover retries. The sibling method _wrap_async_call() already correctly uses await asyncio.sleep().
This commit is contained in:
1 file changed
+1
-1
@@ -185,7 +185,7 @@ class SentinelRedisProxy:
|
|||||||
if proxy._should_retry(attempt):
|
if proxy._should_retry(attempt):
|
||||||
proxy._log_retry(exc, attempt)
|
proxy._log_retry(exc, attempt)
|
||||||
if REDIS_RECONNECT_DELAY:
|
if REDIS_RECONNECT_DELAY:
|
||||||
time.sleep(REDIS_RECONNECT_DELAY / 1000)
|
await asyncio.sleep(REDIS_RECONNECT_DELAY / 1000)
|
||||||
continue
|
continue
|
||||||
proxy._log_exhausted(exc)
|
proxy._log_exhausted(exc)
|
||||||
raise
|
raise
|
||||||
|
|||||||
Reference in new issue
Block a user