From 3ccbff606580ec01cac23db9602628f931a68787 Mon Sep 17 00:00:00 2001 From: GenericPseudonym <14191187+GenericPseudonym@users.noreply.github.com> Date: Fri, 11 Feb 2022 13:38:23 -0800 Subject: [PATCH 1/2] Add websockets to requirements list Since it won't run without it --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 121f094b..0ed5ab20 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ aiohttp>2.0,<4.0 pystray +websockets \ No newline at end of file From 445aa1af32ea341a49949e3c9520dd1a2cb4c79d Mon Sep 17 00:00:00 2001 From: GenericPseudonym <14191187+GenericPseudonym@users.noreply.github.com> Date: Fri, 11 Feb 2022 13:42:09 -0800 Subject: [PATCH 2/2] Handle having too many topics gracefully Rather than hanging and becoming unresponsive due to an unhandled exception --- twitch.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/twitch.py b/twitch.py index 6dd04fcb..ab4dd23f 100644 --- a/twitch.py +++ b/twitch.py @@ -49,6 +49,8 @@ WebsocketTopic, ) +from exceptions import MinerException + if TYPE_CHECKING: from gui import LoginForm from main import ParsedArgs @@ -293,7 +295,15 @@ async def run(self): ) for channel_id in self.channels ] - self.websocket.add_topics(topics) + + try: + self.websocket.add_topics(topics) + except MinerException as err: + # don't panic if we have more topics than available sockets + # but still log an error + logger.error(err) + pass + # relink watching channel after cleanup, # or stop watching it if it no longer qualifies watching_channel = self.watching_channel.get_with_default(None)