summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2019-01-27 11:52:01 -0800
committerGitHub <noreply@github.com>2019-01-27 11:52:01 -0800
commitb940d073de4c13f8dfb08728965c6ac7c183c935 (patch)
tree72d9ca3567f9c00853873154bebc1b31ee6c1e14
parentcac28e59c15a025861056f30a1502c4894b172a6 (diff)
parent7860995ce4226ee0ca82d2eefa4b8bd5c3943a75 (diff)
downloadredis-py-b940d073de4c13f8dfb08728965c6ac7c183c935.tar.gz
Merge pull request #1023 from ycraaron/1022-fix-retry-logic
1022: Fix retry logic for StricRedis and PubSub
-rwxr-xr-xredis/client.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/redis/client.py b/redis/client.py
index 94b1baa..24120d2 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -775,7 +775,8 @@ class Redis(object):
return self.parse_response(connection, command_name, **options)
except (ConnectionError, TimeoutError) as e:
connection.disconnect()
- if not connection.retry_on_timeout and isinstance(e, TimeoutError):
+ if not (connection.retry_on_timeout and
+ isinstance(e, TimeoutError)):
raise
connection.send_command(*args)
return self.parse_response(connection, command_name, **options)
@@ -3012,7 +3013,8 @@ class PubSub(object):
return command(*args)
except (ConnectionError, TimeoutError) as e:
connection.disconnect()
- if not connection.retry_on_timeout and isinstance(e, TimeoutError):
+ if not (connection.retry_on_timeout and
+ isinstance(e, TimeoutError)):
raise
# Connect manually here. If the Redis server is down, this will
# fail and raise a ConnectionError as desired.