Skip to content

site: surface a new release within a minute, not an hour - #1

Merged
ralyodio merged 1 commit into
mainfrom
site/faster-release-cache
Aug 30, 2026
Merged

site: surface a new release within a minute, not an hour#1
ralyodio merged 1 commit into
mainfrom
site/faster-release-cache

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

v0.1.8 was published, built and downloadable while diskpush.com/download still offered v0.1.7.

The page was already force-dynamic, so it re-rendered on every request — but the fetch underneath 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 the force-dynamic change was meant to fix, moved one layer down.

Three caches gated the same fact, all set to an hour:

before after
lib/releases.ts — GitHub fetch revalidate: 3600 revalidate: 60
api/releases/latest — route revalidate = 3600 revalidate = 60
api/releases/latest — downstream s-maxage=3600 s-maxage=60

Lowering 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.tsx now 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 a GITHUB_TOKEN header rather than a longer window.

Typecheck passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Y5jnkZKX4AdPgBMzMosxE7

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
@ralyodio
ralyodio merged commit 1798a06 into main Aug 30, 2026
4 checks passed
@ralyodio
ralyodio deleted the site/faster-release-cache branch August 30, 2026 03:11
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