diff options
Diffstat (limited to 'redis/connection.py')
| -rwxr-xr-x | redis/connection.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/redis/connection.py b/redis/connection.py index 5fdac54..508c196 100755 --- a/redis/connection.py +++ b/redis/connection.py @@ -604,7 +604,9 @@ class Connection: if self._sock: return try: - sock = self._connect() + sock = self.retry.call_with_retry( + lambda: self._connect(), lambda error: self.disconnect(error) + ) except socket.timeout: raise TimeoutError("Timeout connecting to server") except OSError as e: @@ -721,7 +723,7 @@ class Connection: if str_if_bytes(self.read_response()) != "OK": raise ConnectionError("Invalid Database") - def disconnect(self): + def disconnect(self, *args): "Disconnects from the Redis server" self._parser.on_disconnect() if self._sock is None: |
