exp backoff 0 shift + fix quick retry logic
This commit is contained in:
1 parent
76a34685da
commit
3c6fecb039
2 files changed
+3
-3
No files matched your search
@@ -869,7 +869,7 @@ class Twitch:
|
|||||||
if self.settings.proxy and "proxy" not in kwargs:
|
if self.settings.proxy and "proxy" not in kwargs:
|
||||||
kwargs["proxy"] = self.settings.proxy
|
kwargs["proxy"] = self.settings.proxy
|
||||||
logger.debug(f"Request: ({method=}, {url=}, {kwargs=})")
|
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:
|
if self.gui.close_requested:
|
||||||
raise ExitRequest()
|
raise ExitRequest()
|
||||||
try:
|
try:
|
||||||
@@ -893,7 +893,7 @@ class Twitch:
|
|||||||
yield response
|
yield response
|
||||||
return
|
return
|
||||||
except (aiohttp.ClientConnectionError, asyncio.TimeoutError):
|
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:
|
if delay > 1:
|
||||||
self.print(_("error", "no_connection").format(seconds=round(delay)))
|
self.print(_("error", "no_connection").format(seconds=round(delay)))
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ class ExponentialBackoff:
|
|||||||
*,
|
*,
|
||||||
base: float = 2,
|
base: float = 2,
|
||||||
variance: float | tuple[float, float] = 0.1,
|
variance: float | tuple[float, float] = 0.1,
|
||||||
shift: float = -1,
|
shift: float = 0,
|
||||||
maximum: float = 300,
|
maximum: float = 300,
|
||||||
):
|
):
|
||||||
if base <= 1:
|
if base <= 1:
|
||||||
|
|||||||
Reference in new issue
Block a user