OF: Don't loop over nothing!
diff --git a/commitbot.py b/commitbot.py index 8a04fac..b81ebd5 100644 --- a/commitbot.py +++ b/commitbot.py
@@ -159,19 +159,18 @@ async def pubsub_poll(self): while True: - try: - async for payload in asfpy.pubsub.listen(self.config["pubsub_host"]): - root, msg = format_message(payload) - if msg: - to_channels = [] - for channel, data in self.config["channels"].items(): - for tag in data.get("tags", []): - if fnmatch.fnmatch(root, tag): - to_channels.append(channel) - break - if to_channels: - self.connection.privmsg_many(to_channels, msg) - await asyncio.sleep(1) # Don't flood too quickly + async for payload in asfpy.pubsub.listen(self.config["pubsub_host"]): + root, msg = format_message(payload) + if msg: + to_channels = [] + for channel, data in self.config["channels"].items(): + for tag in data.get("tags", []): + if fnmatch.fnmatch(root, tag): + to_channels.append(channel) + break + if to_channels: + self.connection.privmsg_many(to_channels, msg) + await asyncio.sleep(1) # Don't flood too quickly self.connection.quit("Bye!")