diff options
-rw-r--r-- | redis/sentinel.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/redis/sentinel.py b/redis/sentinel.py index 025ab39..b3f1490 100644 --- a/redis/sentinel.py +++ b/redis/sentinel.py @@ -37,7 +37,7 @@ class SentinelManagedConnection(Connection): if str_if_bytes(self.read_response()) != "PONG": raise ConnectionError("PING failed") - def connect(self): + def _connect_retry(self): if self._sock: return # already connected if self.connection_pool.is_master: @@ -50,6 +50,12 @@ class SentinelManagedConnection(Connection): continue raise SlaveNotFoundError # Never be here + def connect(self): + return self.retry.call_with_retry( + self._connect_retry, + lambda error: None, + ) + def read_response(self, disable_decoding=False): try: return super().read_response(disable_decoding=disable_decoding) |