Repository navigation
gallery: read the version the store holds, and write it conditionally - #8
Merged
Merged
Conversation
The landing page's dashboard draws from gallery/recent.json, rewritten by every build. The blob CDN serves an overwritten blob long past its 60 s max-age: /api/gallery kept answering vercel at 14,661 commits for more than 15 minutes after the rebuild that put it at 19,089 was stored, and the build that read a stale copy and wrote it back undid the build before it (sindresorhus is stored at an older 2,696; its city is 2,826). The "fresh" read appends a query string, which the CDN ignores. - Each version is also written to gallery/recent/<id>.json, never overwritten, so any CDN copy of it is the right one. - gallery/recent.json carries the current id in its content type; a head request reads that from the store, not the CDN. The list stays in its body too, for readers from before this change. - Writes are conditional on its etag (ifMatch) and retry with backoff, so builds that finish together all get in. - Featured cities take their entry from the list when they are in it, so the featured and latest-built tiles show the same build. Cost per build: one head (simple op) and one more put; per gallery read, one head. #4 covers the same ground with a list per read, which the Hobby quota cannot carry; this handles the gallery half of it without one.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
facebook/react moved to react/react, and the landing page showed both: a featured react/react tile with 685 commits (a city built under the old name on 2026-10-11) and a latest-built one with 689 (built under the new name a day later), the first opening the second. Featured now names react/react, and entries kept under a repo's old name stay off the lists.
This branch was successfully deployed
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.
What's wrong
The homepage dashboard draws from
gallery/recent.json, which every build rewrites. In production right now:/api/gallerysaysThe Blob CDN keeps serving an overwritten blob long after its 60 s max-age (a copy aged 194 s was a HIT, and
/api/gallerywas still answering 14,661 more than 15 minutes after the overwrite). The store's "fresh" read appends a?fresh=query string, which the CDN ignores. So a build that read a stale copy and wrote it back also undid the build before it: sindresorhus's 11:01 entry was lost to vercel's 11:02 write.Fix
gallery/recent/<id>.json. Those blobs are never overwritten, so any CDN copy of them is correct.gallery/recent.jsoncarries the current id in its content type,application/json; version=<id>. Aheadrequest reads it from the store, not the CDN. The list also stays in the body, for readers from before this change.ifMatch) and retry with backoff, so builds that finish together all get in.Cost (Hobby quota)
head(a simple op) and one extra put.head, under the endpoint's 60 s edge cache.#4 covers the same ground with a
listper read, which the 2,000 advanced ops a month can't carry. This handles the gallery half of #4 without one.Tests
statand conditional writes see the store itself. Against it:After merge
Check that the store keeps the content type's
versionparameter: the blob's public URL returnscontent-typeas stored. If the store dropped it, reads would fall back to today's behaviour.