You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have encountered an issue with reconnects or changes of the network while running the bot.
When the network connection is dead for less than one minute, the cached connections from the websocket may still work, but when the network is offline for more than 5 minutes, then the websocket will reconnect, but the previous connections from the websocket._cache dictionary are outdated and dead. The Library will not connect automatically to the previously connected channels.
I could fix it for my concrete usage with an overloaded version of the following method in Client's subclass:
async def event_ready(self):
# We are logged in and ready to chat and use commands...
self._logger.info(f'Logged in on Twitch as | {self.nick}')
if len(self._connection._cache) > 1:
keys_to_delete = []
for key in self._connection._cache.keys():
if key != "duffy356":
self._logger.info(f"logged in with {key} in cache")
keys_to_delete.append(key)
for key in keys_to_delete:
del self._connection._cache[key]
self._logger.info(f"removed all users from cache that were outdated!")
It would be nice to automatically reconnect to the connected channels from the websocket's cache or at least remove the entries from the cache, so that a new call of join_channels("a") will allow the library to make a new connection to channel "a".
The text was updated successfully, but these errors were encountered:
I assume this has not been resolved? I do believe this is an issue I'm encountered now..
when my PC is put to sleep for more than a few minutes then when coming back online the chatbot is no longer connected.. although some parts of it do seem to still be active which is a bit odd.
I have encountered an issue with reconnects or changes of the network while running the bot.
When the network connection is dead for less than one minute, the cached connections from the websocket may still work, but when the network is offline for more than 5 minutes, then the websocket will reconnect, but the previous connections from the websocket._cache dictionary are outdated and dead. The Library will not connect automatically to the previously connected channels.
I could fix it for my concrete usage with an overloaded version of the following method in Client's subclass:
It would be nice to automatically reconnect to the connected channels from the websocket's cache or at least remove the entries from the cache, so that a new call of join_channels("a") will allow the library to make a new connection to channel "a".
The text was updated successfully, but these errors were encountered: