Spaces:
Running
Running
Bypass CDN cache when resolving the latest snapshot at build time
Browse filesThe tree listing can lag a fresh publish by minutes, silently pinning
the previous snapshot into the image (bit us on the 2026-08-21 deploy).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
scripts/resolve-latest-snapshot.mjs
CHANGED
|
@@ -23,7 +23,9 @@ const treeUrl = `https://huggingface.co/api/datasets/${REPO}/tree/${BRANCH}/ware
|
|
| 23 |
|
| 24 |
let entries
|
| 25 |
try {
|
| 26 |
-
|
|
|
|
|
|
|
| 27 |
if (!res.ok) throw new Error(`HTTP ${res.status} from ${treeUrl}`)
|
| 28 |
entries = await res.json()
|
| 29 |
} catch (e) {
|
|
|
|
| 23 |
|
| 24 |
let entries
|
| 25 |
try {
|
| 26 |
+
// no-cache: the tree listing is CDN-cached and can lag a fresh publish by
|
| 27 |
+
// minutes — a build racing a publish would silently pin the previous snapshot.
|
| 28 |
+
const res = await fetch(treeUrl, { headers: { "Cache-Control": "no-cache" } })
|
| 29 |
if (!res.ok) throw new Error(`HTTP ${res.status} from ${treeUrl}`)
|
| 30 |
entries = await res.json()
|
| 31 |
} catch (e) {
|