|
5 | 5 | from redis.client import Redis
|
6 | 6 | from redis.commands import SentinelCommands
|
7 | 7 | from redis.connection import Connection, ConnectionPool, SSLConnection
|
8 | | -from redis.exceptions import ConnectionError, ReadOnlyError, ResponseError, TimeoutError |
9 | | -from redis.utils import str_if_bytes |
| 8 | +from redis.exceptions import ( |
| 9 | + ConnectionError, |
| 10 | + ReadOnlyError, |
| 11 | + ResponseError, |
| 12 | + TimeoutError, |
| 13 | +) |
10 | 14 |
|
11 | 15 |
|
12 | 16 | class MasterNotFoundError(ConnectionError):
|
@@ -35,11 +39,11 @@ def __repr__(self):
|
35 | 39 |
|
36 | 40 | def connect_to(self, address):
|
37 | 41 | self.host, self.port = address
|
38 | | -super().connect() |
39 | | - ifself.connection_pool.check_connection: |
40 | | - self.send_command("PING") |
41 | | - ifstr_if_bytes(self.read_response()) !="PONG": |
42 | | - raiseConnectionError("PING failed") |
| 42 | + |
| 43 | + self.connect_check_health( |
| 44 | + check_health=self.connection_pool.check_connection, |
| 45 | + retry_socket_connect=False, |
| 46 | + ) |
43 | 47 |
|
44 | 48 | def _connect_retry(self):
|
45 | 49 | if self._sock:
|
|
0 commit comments