Fix initial content flood on new source subscription#192
Merged
user1303836 merged 1 commit intomainfrom Feb 7, 2026
Merged
Conversation
On first poll, store all fetched items in the database but immediately mark all except the most recent as backfilled. This prevents old items from being re-discovered and posted on subsequent poll cycles. Previously, first poll stored only 1 item and broke out of the loop. On the second poll, the remaining items were treated as new content and flooded the Discord channel.
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_handle_first_posting_backfillsafety net insummarize_pendingis retained as a secondary defenseRoot Cause
The previous approach stored only 1 item on first poll then broke out of the loop. On the next poll cycle, the adapter would return the same batch of items. The 1 already-stored item was skipped, but all remaining items were treated as new content and posted to Discord.
Test plan
test_first_poll_stores_all_items_and_backfills- verifies all items stored and backfill calledtest_first_poll_no_backfill_when_single_item- verifies single-item first poll works correctlytest_subsequent_poll_stores_all_new_items- verifies non-first polls unchanged