Skip to content

Commit

Permalink
Merge pull request #1 from ziollek/fix_issue_1140
Browse files Browse the repository at this point in the history
Fix issue redis#1140 - reconnect on ConnectionError while executing command
  • Loading branch information
ziollek authored Jun 19, 2019
2 parents da2ffc7 + 716d085 commit a31104b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions redis/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,8 +809,7 @@ def execute_command(self, *args, **options):
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)
Expand Down Expand Up @@ -3098,8 +3097,7 @@ def _execute(self, connection, command, *args):
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.
Expand Down

0 comments on commit a31104b

Please sign in to comment.