Repository navigation
perf(feed): recompute the trending board every 30 minutes - #666
Open
harlan-github-agent[bot] wants to merge 1 commit into
Open
harlan-github-agent[bot] wants to merge 1 commit into
harlan-github-agent[bot] wants to merge 1 commit into
Conversation
Contributor
Author
🤖 QUEUED
Next: Review starts when an Agent is free. |
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.
🔗 Linked issue
Closes #665
❓ Type of change
📚 Description
The d1-query-review routine measured the trending feed at 3,196 executions and 112.9 million row reads in one week, up 72% with post volume, and the cause sits in the feed's cache window: the board recomputed its full 14-day post scan every five minutes, while its fastest input, X posts from
sync-x-mentions, lands every 15 minutes at most. Two of every three recomputes could not have seen new data.The feed now holds its answer for 30 minutes, a full ingest cadence, and keeps the hour-long stale fallback so a D1 overload still serves the last good board. The compute is untouched, so rankings stay identical; only how often they are recomputed changes. Four nearby comments stated the old five-minute window as fact (the
/skills/trendingedge-cache rationale innuxt.config.ts, the homepage and browse-page fetches, the v1 proxy); they now say 30 minutes.One tradeoff worth a reviewer's eye: the board's "as of" timestamp can now lag an ingest by up to 30 minutes instead of 5. I left the
/skills/trendingedge rule (60s fresh, 3600s stale) alone; its stale window already assumed inputs move on a 15-minute cadence.