From ddc51c4ace0caa0787715801b9df42e65c790d46 Mon Sep 17 00:00:00 2001 From: Bar Shaul <88437685+barshaul@users.noreply.github.com> Date: Thu, 23 Dec 2021 11:42:30 +0200 Subject: Support for specifying error types with retry (#1817) --- redis/retry.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'redis/retry.py') diff --git a/redis/retry.py b/redis/retry.py index 75504c7..6147fbd 100644 --- a/redis/retry.py +++ b/redis/retry.py @@ -19,6 +19,14 @@ class Retry: self._retries = retries self._supported_errors = supported_errors + def update_supported_erros(self, specified_errors: list): + """ + Updates the supported errors with the specified error types + """ + self._supported_errors = tuple( + set(self._supported_errors + tuple(specified_errors)) + ) + def call_with_retry(self, do, fail): """ Execute an operation that might fail and returns its result, or -- cgit v1.2.1