summaryrefslogtreecommitdiff
path: root/redis/connection.py
diff options
context:
space:
mode:
authorEric Lemoine <eric.lemoine@getalma.eu>2022-06-19 03:56:53 +0200
committerGitHub <noreply@github.com>2022-06-19 04:56:53 +0300
commitbea72995fd39b01e2f0a1682b16b6c7690933f36 (patch)
tree477b9093e9664a13add96681a2012ded0ffbc798 /redis/connection.py
parent33702983b8b0a55d29189babb631ea108ee8404f (diff)
downloadredis-py-bea72995fd39b01e2f0a1682b16b6c7690933f36.tar.gz
Fix retries in async mode (#2180)
* Avoid mutating a global retry_on_error list * Make retries config consistent in sync and async * Fix async retries * Add new TestConnectionConstructorWithRetry tests
Diffstat (limited to 'redis/connection.py')
-rwxr-xr-xredis/connection.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/redis/connection.py b/redis/connection.py
index 1bc2ae1..3438baf 100755
--- a/redis/connection.py
+++ b/redis/connection.py
@@ -515,7 +515,7 @@ class Connection:
socket_keepalive_options=None,
socket_type=0,
retry_on_timeout=False,
- retry_on_error=[],
+ retry_on_error=SENTINEL,
encoding="utf-8",
encoding_errors="strict",
decode_responses=False,
@@ -547,6 +547,8 @@ class Connection:
self.socket_keepalive_options = socket_keepalive_options or {}
self.socket_type = socket_type
self.retry_on_timeout = retry_on_timeout
+ if retry_on_error is SENTINEL:
+ retry_on_error = []
if retry_on_timeout:
# Add TimeoutError to the errors list to retry on
retry_on_error.append(TimeoutError)
@@ -1065,7 +1067,7 @@ class UnixDomainSocketConnection(Connection):
encoding_errors="strict",
decode_responses=False,
retry_on_timeout=False,
- retry_on_error=[],
+ retry_on_error=SENTINEL,
parser_class=DefaultParser,
socket_read_size=65536,
health_check_interval=0,
@@ -1088,6 +1090,8 @@ class UnixDomainSocketConnection(Connection):
self.password = password
self.socket_timeout = socket_timeout
self.retry_on_timeout = retry_on_timeout
+ if retry_on_error is SENTINEL:
+ retry_on_error = []
if retry_on_timeout:
# Add TimeoutError to the errors list to retry on
retry_on_error.append(TimeoutError)