Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timeout retrying on pipeline execution #2812

Merged
merged 2 commits into from
Aug 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions redis/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,7 @@ def load_scripts(self):
def _disconnect_raise_reset(self, conn, error):
"""
Close the connection, raise an exception if we were watching,
and raise an exception if retry_on_timeout is not set,
and raise an exception if TimeoutError is not part of retry_on_error,
or the error is not a TimeoutError
"""
conn.disconnect()
Expand All @@ -1390,11 +1390,13 @@ def _disconnect_raise_reset(self, conn, error):
raise WatchError(
"A ConnectionError occurred on while watching one or more keys"
)
# if retry_on_timeout is not set, or the error is not
# a TimeoutError, raise it
if not (conn.retry_on_timeout and isinstance(error, TimeoutError)):
# if TimeoutError is not part of retry_on_error, or the error
# is not a TimeoutError, raise it
if not (
TimeoutError in conn.retry_on_error and isinstance(error, TimeoutError)
):
self.reset()
raise
raise error

def execute(self, raise_on_error=True):
"""Execute all the commands in the current pipeline"""
Expand Down