mirror of
https://github.com/rangermix/TwitchDropsMiner.git
synced 2026-06-07 04:49:36 +00:00
Handle having too many topics gracefully
Rather than hanging and becoming unresponsive due to an unhandled exception
This commit is contained in:
12
twitch.py
12
twitch.py
@@ -49,6 +49,8 @@ from constants import (
|
||||
WebsocketTopic,
|
||||
)
|
||||
|
||||
from exceptions import MinerException
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from gui import LoginForm
|
||||
from main import ParsedArgs
|
||||
@@ -293,7 +295,15 @@ class Twitch:
|
||||
)
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user