mirror of
https://github.com/rangermix/TwitchDropsMiner.git
synced 2026-05-30 08:59:36 +00:00
Account for the request invalidation happening during the request
This commit is contained in:
@@ -974,10 +974,17 @@ class Twitch:
|
||||
if self.settings.proxy and "proxy" not in kwargs:
|
||||
kwargs["proxy"] = self.settings.proxy
|
||||
logger.debug(f"Request: ({method=}, {url=}, {kwargs=})")
|
||||
session_timeout = timedelta(
|
||||
seconds=cast(aiohttp.ClientTimeout, session.timeout).total or 0
|
||||
)
|
||||
for delay in ExponentialBackoff(maximum=3*60):
|
||||
if self.gui.close_requested:
|
||||
raise ExitRequest()
|
||||
elif invalidate_after is not None and datetime.now(timezone.utc) >= invalidate_after:
|
||||
elif (
|
||||
invalidate_after is not None
|
||||
# account for the expiration landing during the request
|
||||
and datetime.now(timezone.utc) >= (invalidate_after - session_timeout)
|
||||
):
|
||||
raise ReloadRequest()
|
||||
try:
|
||||
response: aiohttp.ClientResponse | None = None
|
||||
|
||||
Reference in New Issue
Block a user