Open adhawkins opened 4 months ago
Workaround, we can increase reconnect_delay_steps
, to some high value. This is will increase chance to reconnect automatically. https://github.com/Teekeks/pyTwitchAPI/blob/2b90657491108cec172578afa0967c88282eddd0/twitchAPI/chat/__init__.py#L589C9-L589C81
Modify Chat
instance, some like this:
chat = await Chat(twitch)
reconnect_steps = [i*i for i in range(50)] # 11 hours
print(f"Hours to reconnect: {sum(reconnect_steps) // 3600}") # replace to logger
chat.reconnect_delay_steps = reconnect_steps
I not verified this, but it can work.
There apparently isn't a way that this exception could be caught
So except TwitchBackendException: ...
not working? According to logs this is possible.
correct, thats what that var is for
I have a chat bot based on pytwitchapi. My internet was down for a few hours recently, and it was only when I happened to notice the bot wasn't working when I realised that it had failed to connect to the Twitch API (understandably) and gave up attempting to reconnect:
There apparently isn't a way that this exception could be caught so that the client can tell the library to initiate a re-connect.
Posting here at Lena's request (from Discord)