Skip to content

Commit b940d07

Browse files
authored
Merge pull request #1023 from ycraaron/1022-fix-retry-logic
1022: Fix retry logic for StricRedis and PubSub
2 parents cac28e5 + 7860995 commit b940d07

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

redis/client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,8 @@ def execute_command(self, *args, **options):
775775
return self.parse_response(connection, command_name, **options)
776776
except (ConnectionError, TimeoutError) as e:
777777
connection.disconnect()
778-
if not connection.retry_on_timeout and isinstance(e, TimeoutError):
778+
if not (connection.retry_on_timeout and
779+
isinstance(e, TimeoutError)):
779780
raise
780781
connection.send_command(*args)
781782
return self.parse_response(connection, command_name, **options)
@@ -3012,7 +3013,8 @@ def _execute(self, connection, command, *args):
30123013
return command(*args)
30133014
except (ConnectionError, TimeoutError) as e:
30143015
connection.disconnect()
3015-
if not connection.retry_on_timeout and isinstance(e, TimeoutError):
3016+
if not (connection.retry_on_timeout and
3017+
isinstance(e, TimeoutError)):
30163018
raise
30173019
# Connect manually here. If the Redis server is down, this will
30183020
# fail and raise a ConnectionError as desired.

0 commit comments

Comments
 (0)