Skip to content

Commit dfa9a97

Browse files
committed
rss_bot: Handle oldest-first RSS feeds correctly.
This change ensures the bot continues scanning the entire feed so all new entries are detected regardless of feed order,so new feeds are not missed. Fixes #831.
1 parent be1e076 commit dfa9a97

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

zulip/integrations/rss/rss-bot

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,14 @@ for feed_url in feed_urls:
234234
# entries older than some threshold.
235235
continue
236236
if entry_hash in old_feed_hashes:
237-
# We've already seen this. No need to process any older entries.
238-
break
239-
if not old_feed_hashes and len(new_hashes) >= 3:
240-
# On a first run, pick up the 3 most recent entries. An RSS feed has
241-
# entries in reverse chronological order.
242-
break
237+
# We've already processed this entry; skip it but continue scanning
238+
# the feed, since entries may not be ordered newest-first.
239+
continue
243240

241+
if not old_feed_hashes and len(new_hashes) >= 3:
242+
# On a first run, limit how many entries we post, but continue scanning
243+
# the feed to record newer entries that may appear later.
244+
continue
244245
feed_name: str = data.feed.title or feed_url
245246

246247
response: Dict[str, Any] = send_zulip(entry, feed_name)

0 commit comments

Comments
 (0)