From 428b471fec923752a855cee487e225778cc35d3f Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 22 Feb 2022 23:11:11 +0200 Subject: [PATCH] Add some logs and hacky sorting --- rss/bot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rss/bot.py b/rss/bot.py index 12cf9ee..62941a5 100644 --- a/rss/bot.py +++ b/rss/bot.py @@ -122,6 +122,7 @@ class RSSBot(Plugin): tasks = [self.try_parse_feed(feed=feed) for feed in subs if feed.next_retry < now] feed: Feed entries: Iterable[Entry] + self.log.info(f"Polling {len(tasks)} feeds") for res in asyncio.as_completed(tasks): feed, entries = await res self.log.trace(f"Fetching {feed.id} (backoff: {feed.error_count} / {feed.next_retry}) " @@ -146,8 +147,10 @@ class RSSBot(Plugin): new_entries.pop(old_entry.id, None) self.log.trace(f"Feed {feed.id} had {len(new_entries)} new entries") self.db.add_entries(new_entries.values()) - for entry in new_entries.values(): + # TODO sort properly? + for entry in reversed(new_entries.values()): await self._broadcast(feed, entry, feed.subscriptions) + self.log.info(f"Finished polling {len(tasks)} feeds") async def _poll_feeds(self) -> None: self.log.debug("Polling started")