Restart watching on GAMES_UPDATE

This commit is contained in:
DevilXD committed 2022-04-07 19:15:46 +02:00
1 parent 281b9274ed
commit 634119b254
1 file changed
+2 -2
+2 -2
View File
@@ -231,6 +231,7 @@ class Twitch:
# non-excluded games with no priority, are placed last, below priority ones
self.games[game] = priorities.get(game.name, 0)
full_cleanup = True
self.restart_watching()
self.change_state(State.CHANNELS_CLEANUP)
elif self._state is State.CHANNELS_CLEANUP:
if not self.games or full_cleanup:
@@ -386,8 +387,7 @@ class Twitch:
# post-main-loop code goes here
async def _watch_sleep(self, delay: float) -> None:
# we use wait_for here to allow an asyncio.sleep that can be ended prematurely,
# without cancelling the containing task
# we use wait_for here to allow an asyncio.sleep-like that can be ended prematurely
self._watching_restart.clear()
with suppress(asyncio.TimeoutError):
await asyncio.wait_for(self._watching_restart.wait(), timeout=delay)