Skip to content

feat: add weekly per-source item-retention prune cron#10

Merged
phatpham9 merged 1 commit into
mainfrom
feature/feed-retention-prune
Jun 23, 2026
Merged

feat: add weekly per-source item-retention prune cron#10
phatpham9 merged 1 commit into
mainfrom
feature/feed-retention-prune

Conversation

@phatpham9

Copy link
Copy Markdown
Member

Adds a second Cron Trigger (Sunday 23:00 ICT) that deletes all but the most recent FEEDREADER_MAX_ITEMS_PER_SOURCE (default 1000) items per source, keeping the items table and every full-table-scan query against it bounded as more sources get added.

1000/source was sized against D1's rows-read quota, not disk: live prod data showed ~700-750 bytes/row and per-source velocity slow enough that even 4 sources at the cap stay well under D1 Free's 500MB limit, but listFeedItems reads sources*cap rows per unfiltered request with no SQL LIMIT, which is the actual scaling risk against the 5M-rows/day free budget.

Adds a second Cron Trigger (Sunday 23:00 ICT) that deletes all but the
most recent FEEDREADER_MAX_ITEMS_PER_SOURCE (default 1000) items per
source, keeping the items table and every full-table-scan query
against it bounded as more sources get added.

1000/source was sized against D1's rows-read quota, not disk: live
prod data showed ~700-750 bytes/row and per-source velocity slow
enough that even 4 sources at the cap stay well under D1 Free's
500MB limit, but listFeedItems reads sources*cap rows per unfiltered
request with no SQL LIMIT, which is the actual scaling risk against
the 5M-rows/day free budget.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🔎 Cloudflare preview: https://62bb8302-feedreader.phatpham9.workers.dev

Uploaded from b6a67433d51e9039d8bc224c603d9146a3d1412b. This is a Worker version preview — it shares the production D1 database, so it reads/writes real data; it does not receive cron-triggered refreshes.

@phatpham9 phatpham9 merged commit 2694d11 into main Jun 23, 2026
2 checks passed
@phatpham9 phatpham9 deleted the feature/feed-retention-prune branch June 23, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant