summaryrefslogtreecommitdiff
path: root/redis/asyncio/sentinel.py
diff options
context:
space:
mode:
Diffstat (limited to 'redis/asyncio/sentinel.py')
-rw-r--r--redis/asyncio/sentinel.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/redis/asyncio/sentinel.py b/redis/asyncio/sentinel.py
index 5aefd09..99c5074 100644
--- a/redis/asyncio/sentinel.py
+++ b/redis/asyncio/sentinel.py
@@ -44,7 +44,7 @@ class SentinelManagedConnection(Connection):
if str_if_bytes(await self.read_response()) != "PONG":
raise ConnectionError("PING failed")
- async def connect(self):
+ async def _connect_retry(self):
if self._reader:
return # already connected
if self.connection_pool.is_master:
@@ -57,6 +57,12 @@ class SentinelManagedConnection(Connection):
continue
raise SlaveNotFoundError # Never be here
+ async def connect(self):
+ return await self.retry.call_with_retry(
+ self._connect_retry,
+ lambda error: asyncio.sleep(0),
+ )
+
async def read_response(self, disable_decoding: bool = False):
try:
return await super().read_response(disable_decoding=disable_decoding)