diff options
author | Bar Shaul <88437685+barshaul@users.noreply.github.com> | 2022-01-25 09:01:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-25 09:01:48 +0200 |
commit | 039257613f523e6a30736f218ca2d37d2f12320f (patch) | |
tree | 0b8f7bade605d5978d36925ce69db6d6ae7cb4ea /redis/retry.py | |
parent | fa5841e50c242a7584eedda59ea918570adbf729 (diff) | |
download | redis-py-039257613f523e6a30736f218ca2d37d2f12320f.tar.gz |
Added retry mechanism on socket timeouts when connecting to the server (#1895)
Diffstat (limited to 'redis/retry.py')
-rw-r--r-- | redis/retry.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/redis/retry.py b/redis/retry.py index 6147fbd..3dced35 100644 --- a/redis/retry.py +++ b/redis/retry.py @@ -1,3 +1,4 @@ +import socket from time import sleep from redis.exceptions import ConnectionError, TimeoutError @@ -7,7 +8,10 @@ class Retry: """Retry a specific number of times after a failure""" def __init__( - self, backoff, retries, supported_errors=(ConnectionError, TimeoutError) + self, + backoff, + retries, + supported_errors=(ConnectionError, TimeoutError, socket.timeout), ): """ Initialize a `Retry` object with a `Backoff` object |