summaryrefslogtreecommitdiff
path: root/redis
diff options
context:
space:
mode:
Diffstat (limited to 'redis')
-rw-r--r--redis/asyncio/sentinel.py3
-rw-r--r--redis/sentinel.py10
2 files changed, 11 insertions, 2 deletions
diff --git a/redis/asyncio/sentinel.py b/redis/asyncio/sentinel.py
index 9147ed8..501e234 100644
--- a/redis/asyncio/sentinel.py
+++ b/redis/asyncio/sentinel.py
@@ -67,11 +67,14 @@ class SentinelManagedConnection(Connection):
self,
disable_decoding: bool = False,
timeout: Optional[float] = None,
+ *,
+ disconnect_on_error: Optional[float] = True,
):
try:
return await super().read_response(
disable_decoding=disable_decoding,
timeout=timeout,
+ disconnect_on_error=disconnect_on_error,
)
except ReadOnlyError:
if self.connection_pool.is_master:
diff --git a/redis/sentinel.py b/redis/sentinel.py
index ac6921a..f9f8f1c 100644
--- a/redis/sentinel.py
+++ b/redis/sentinel.py
@@ -1,5 +1,6 @@
import random
import weakref
+from typing import Optional
from redis.client import Redis
from redis.commands import SentinelCommands
@@ -53,9 +54,14 @@ class SentinelManagedConnection(Connection):
def connect(self):
return self.retry.call_with_retry(self._connect_retry, lambda error: None)
- def read_response(self, disable_decoding=False):
+ def read_response(
+ self, disable_decoding=False, *, disconnect_on_error: Optional[bool] = False
+ ):
try:
- return super().read_response(disable_decoding=disable_decoding)
+ return super().read_response(
+ disable_decoding=disable_decoding,
+ disconnect_on_error=disconnect_on_error,
+ )
except ReadOnlyError:
if self.connection_pool.is_master:
# When talking to a master, a ReadOnlyError when likely