From fb1b17119f4757b0b40b2513616c136f537abe27 Mon Sep 17 00:00:00 2001 From: MountainGod2 Date: Mon, 15 Apr 2024 08:28:04 -0600 Subject: [PATCH] refactor: updated backoff logic --- src/chaturbate_poller/chaturbate_poller.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/chaturbate_poller/chaturbate_poller.py b/src/chaturbate_poller/chaturbate_poller.py index f6b39fea..1d1fe003 100644 --- a/src/chaturbate_poller/chaturbate_poller.py +++ b/src/chaturbate_poller/chaturbate_poller.py @@ -110,7 +110,7 @@ async def __aexit__( wait_gen=constant, interval=2, jitter=None, - exception=httpx.ReadError, + exception=(httpx.ReadError, httpx.HTTPStatusError), max_tries=10, on_giveup=giveup_handler, on_backoff=backoff_handler, @@ -118,11 +118,12 @@ async def __aexit__( @on_exception( wait_gen=expo, jitter=None, - factor=1.25, + base=1.25, + factor=5, exception=httpx.HTTPStatusError, giveup=lambda retry: not need_retry(retry), on_giveup=giveup_handler, - max_tries=5, + max_tries=6, on_backoff=backoff_handler, ) async def fetch_events(self, url: str | None = None) -> EventsAPIResponse: