From 0f44aac5b863a050cc5df98e4722ad6351939f6b Mon Sep 17 00:00:00 2001 From: DevilXD Date: Mon, 24 Oct 2022 17:40:38 +0200 Subject: [PATCH] Fix site down detection logic --- twitch.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/twitch.py b/twitch.py index 6ed084a..a316fdc 100644 --- a/twitch.py +++ b/twitch.py @@ -1025,12 +1025,12 @@ class Twitch: if response is None: raise RuntimeError("Close request leak") logger.debug(f"Response: {response.status}: {response}") - if response.status >= 500: - self.print(_("error", "site_down").format(seconds=round(delay))) - # pre-read the response to avoid getting errors outside of the context manager - await response.read() - yield response - return + if response.status < 500: + # pre-read the response to avoid getting errors outside of the context manager + await response.read() + yield response + return + self.print(_("error", "site_down").format(seconds=round(delay))) except (aiohttp.ClientConnectionError, asyncio.TimeoutError): # just so that quick retries that often happen, aren't shown if delay > 1: