From 23ab930c0d672b73d161dd0e50b5cb4b24ff21cd Mon Sep 17 00:00:00 2001 From: DevilXD Date: Sat, 8 Jan 2022 15:06:07 +0100 Subject: [PATCH] Simplify the logic of adding channels to the cache --- twitch.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/twitch.py b/twitch.py index 974ddab..0b464f7 100644 --- a/twitch.py +++ b/twitch.py @@ -217,11 +217,11 @@ class Twitch: live_streams: List[Channel] = await self.get_live_streams( selected_game, [DROPS_ENABLED_TAG] ) - # filter out ones we already have - live_streams = [ch for ch in live_streams if ch.id not in self.channels] + # add them, filtering out ones we already have for channel in live_streams: - self.channels[channel.id] = channel - channel.display() + if channel.id not in self.channels: + self.channels[channel.id] = channel + channel.display() # load points # asyncio.gather(*(channel.claim_bonus() for channel in live_streams)) # Sub to these channel updates