Skip to main content

insert_entries

Function insert_entries 

Source
pub async fn insert_entries(
    pool: &SqlitePool,
    feed_id: i64,
    entries: &[NewEntry],
    max_entries_per_feed: i64,
) -> Result<u64>
Expand description

Insert a batch of entries for feed_id, deduping on (feed_id, guid), then trim the feed to at most crate::config-configured max_entries_per_feed rows (newest by published date) so one firehose feed can’t fill the disk.

On a GUID collision the existing entry is updated in place (title/url/body may have changed on re-fetch) rather than duplicated. Runs in one transaction. Returns the number of rows processed.

max_entries_per_feed <= 0 disables the per-feed trim.