From 0b65357918e862934d96e0b614fe02113aca61a6 Mon Sep 17 00:00:00 2001 From: pall-j Date: Mon, 26 Jun 2023 19:43:45 +0200 Subject: [PATCH] Fix timeout retrying on Redis pipeline execution Achieved by modifying Pipeline._disconnect_raise_reset --- redis/client.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/redis/client.py b/redis/client.py index ab626ccdf4..eee7f80871 100755 --- a/redis/client.py +++ b/redis/client.py @@ -2080,7 +2080,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() @@ -2091,11 +2091,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"""