diff --git a/retry_later/lib.py b/retry_later/lib.py index f5a4b62..c327563 100644 --- a/retry_later/lib.py +++ b/retry_later/lib.py @@ -52,7 +52,7 @@ async def wrapper( if retries >= max_retries: raise e delay = retry_interval * (backoff**retries) + random.choice(range(0, max_jitter + 1)) - delay = min(max(0, max_delay), delay) + delay = delay if max_delay == -1 else min(max_delay, delay) logging.error(f"[retry later] Retrying in {delay}s due to {e}") await asyncio.sleep(delay)