Merge isinstance calls

Signed-off-by: shubhendra <withshubh@gmail.com>
This commit is contained in:
shubhendra 2021-03-21 17:14:34 +05:30
parent 45da3a7022
commit 4d81834912
No known key found for this signature in database
GPG Key ID: 9AFEF5C98D542137

View File

@ -140,7 +140,7 @@ def retrier(_func=None, retries=API_RETRY_COUNT):
logger.warning('retrying %s() still for %s times', f.__name__, count) logger.warning('retrying %s() still for %s times', f.__name__, count)
count -= 1 count -= 1
kwargs.update({'count': count}) kwargs.update({'count': count})
if isinstance(ex, DDosProtection) or isinstance(ex, RetryableOrderError): if isinstance(ex, (DDosProtection, RetryableOrderError)):
# increasing backoff # increasing backoff
backoff_delay = calculate_backoff(count + 1, retries) backoff_delay = calculate_backoff(count + 1, retries)
logger.info(f"Applying DDosProtection backoff delay: {backoff_delay}") logger.info(f"Applying DDosProtection backoff delay: {backoff_delay}")