From 3c6fecb03964d2fd48109ba6791e6b2affba6b02 Mon Sep 17 00:00:00 2001 From: DevilXD Date: Mon, 12 Sep 2022 19:37:56 +0200 Subject: [PATCH] exp backoff 0 shift + fix quick retry logic --- twitch.py | 4 ++-- utils.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/twitch.py b/twitch.py index 8e21282..d48d66a 100644 --- a/twitch.py +++ b/twitch.py @@ -869,7 +869,7 @@ class Twitch: if self.settings.proxy and "proxy" not in kwargs: kwargs["proxy"] = self.settings.proxy logger.debug(f"Request: ({method=}, {url=}, {kwargs=})") - for delay in ExponentialBackoff(shift=1, maximum=3*60): + for delay in ExponentialBackoff(maximum=3*60): if self.gui.close_requested: raise ExitRequest() try: @@ -893,7 +893,7 @@ class Twitch: yield response return except (aiohttp.ClientConnectionError, asyncio.TimeoutError): - # just so that quick 2nd retries that often happen, aren't shown + # just so that quick retries that often happen, aren't shown if delay > 1: self.print(_("error", "no_connection").format(seconds=round(delay))) finally: diff --git a/utils.py b/utils.py index 6a43ea5..fd6561c 100644 --- a/utils.py +++ b/utils.py @@ -189,7 +189,7 @@ class ExponentialBackoff: *, base: float = 2, variance: float | tuple[float, float] = 0.1, - shift: float = -1, + shift: float = 0, maximum: float = 300, ): if base <= 1: