From 4b85a9f34b53a8913bf100f2a98e09e56ecfc1c7 Mon Sep 17 00:00:00 2001 From: Seppo Yli-Olli Date: Tue, 30 Jul 2024 11:47:46 +0300 Subject: [PATCH] Define retry exceptions as tuple to retry_if_exception_type This is to improve readability and extensibility of exceptions --- flat-manager-client | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/flat-manager-client b/flat-manager-client index 3fa34de..7ad637a 100755 --- a/flat-manager-client +++ b/flat-manager-client @@ -90,7 +90,12 @@ class FailedJobError(Exception): return "Job failed: %s" % (self.job) -TENACITY_RETRY_EXCEPTIONS = (retry_if_exception_type(aiohttp.client_exceptions.ServerDisconnectedError) | retry_if_exception_type(ServerApiError) | retry_if_exception_type(aiohttp.client_exceptions.ServerConnectionError) | retry_if_exception_type(aiohttp.client_exceptions.ClientOSError)) +TENACITY_RETRY_EXCEPTIONS = retry_if_exception_type(( + aiohttp.client_exceptions.ServerDisconnectedError, + ServerApiError, + aiohttp.client_exceptions.ServerConnectionError, + aiohttp.client_exceptions.ClientOSError, +)) TENACITY_STOP_AFTER = stop_after_delay(300) TENACITY_WAIT_BETWEEN = wait_random_exponential(multiplier=1, max=60)