site: surface a new release within a minute, not an hour - #1
Merged
Conversation
v0.1.8 was published, built and downloadable while diskpush.com/download still offered v0.1.7 — the page renders per request, but the fetch under it was cached for an hour, so re-rendering only ever re-rendered stale data. Three caches gated the same fact and all three were an hour: the GitHub fetch in latestRelease(), the /api/releases/latest route's own revalidate, and the s-maxage it sends downstream. Lowering one and not the others would have left the page and the API it exposes disagreeing about what the latest release is. Next revalidates lazily — on the first request after the window lapses, not on a timer — so 60s is a ceiling of 60 GitHub calls an hour, and the real number tracks traffic rather than the clock. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y5jnkZKX4AdPgBMzMosxE7
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.
v0.1.8 was published, built and downloadable while
diskpush.com/downloadstill offered v0.1.7.The page was already
force-dynamic, so it re-rendered on every request — but thefetchunderneath it was cached for an hour, so re-rendering only ever re-rendered stale data. Rendering per request and fetching per hour is the same freeze theforce-dynamicchange was meant to fix, moved one layer down.Three caches gated the same fact, all set to an hour:
lib/releases.ts— GitHub fetchrevalidate: 3600revalidate: 60api/releases/latest— routerevalidate = 3600revalidate = 60api/releases/latest— downstreams-maxage=3600s-maxage=60Lowering only the first would have left the download page fresh while the public API it exposes still reported an hour-old version — the two disagreeing about what the latest release is.
On rate limits. Next revalidates lazily: on the first request after the window lapses, not on a timer. So 60s is a ceiling of 60 GitHub calls an hour, and the actual number tracks traffic. Unauthenticated GitHub allows exactly 60/hour per IP, so that ceiling is the limit with no headroom — fine at this site's traffic, but worth knowing, and the comment in
download/page.tsxnow records it along with the failure mode (latestRelease()returns null on a refusal, which renders as no release at all). If this ever gets busy, the fix is aGITHUB_TOKENheader rather than a longer window.Typecheck passes.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Y5jnkZKX4AdPgBMzMosxE7