Tolerate transient manifest timeouts (#1016)

Transient timeout fetching manifests have increased significantly
recently, especially with private runners.

```
Fetching manifest data from https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson ...
Error: The operation was aborted due to timeout
```

Retry transient manifest network failures up to three times with a
progressive backoff (not exponential), keeping the total wait bounded
while making setup resilient to short network blips.

Co-authored-by: Raymond <arguile-@users.noreply.github.com>
This commit is contained in:
Raymond
2026-08-13 18:34:10 +02:00
committed by GitHub
co-authored by Raymond
parent ae3b92d1bd
commit d73a0cab66
4 changed files with 100 additions and 7 deletions
Generated Vendored
+19 -2
View File
@@ -99724,6 +99724,7 @@ function formatVariants(entries) {
// src/download/manifest.ts
var cachedManifestData = /* @__PURE__ */ new Map();
var MANIFEST_FETCH_ATTEMPTS = 3;
async function fetchManifest(manifestUrl = VERSIONS_MANIFEST_URL) {
const cachedManifest = cachedManifestData.get(manifestUrl);
if (cachedManifest?.complete === true) {
@@ -99802,8 +99803,24 @@ async function getArtifact(version3, arch3, platform2, manifestUrl = VERSIONS_MA
};
}
async function fetchManifestResponse(manifestUrl) {
info2(`Fetching manifest data from ${manifestUrl} ...`);
const response = await fetch(manifestUrl, {});
let response;
for (let attempt = 1; attempt <= MANIFEST_FETCH_ATTEMPTS; attempt++) {
info2(`Fetching manifest data from ${manifestUrl} ...`);
try {
response = await fetch(manifestUrl, {});
break;
} catch (error2) {
if (attempt >= MANIFEST_FETCH_ATTEMPTS) {
throw error2;
}
const delayMs = 1e3 * 2 ** (attempt - 1);
info2(`Manifest fetch failed; retrying in ${delayMs}ms ...`);
await new Promise((resolve3) => setTimeout(resolve3, delayMs));
}
}
if (response === void 0) {
throw new Error("Manifest fetch attempts exhausted.");
}
if (!response.ok) {
throw new Error(
`Failed to fetch manifest data: ${response.status} ${response.statusText}`
+19 -2
View File
@@ -52390,6 +52390,7 @@ function info2(msg) {
// src/download/manifest.ts
var cachedManifestData = /* @__PURE__ */ new Map();
var MANIFEST_FETCH_ATTEMPTS = 3;
async function fetchManifest(manifestUrl = VERSIONS_MANIFEST_URL) {
const cachedManifest = cachedManifestData.get(manifestUrl);
if (cachedManifest?.complete === true) {
@@ -52430,8 +52431,24 @@ async function getLatestVersion(manifestUrl = VERSIONS_MANIFEST_URL) {
return latestVersion;
}
async function fetchManifestResponse(manifestUrl) {
info2(`Fetching manifest data from ${manifestUrl} ...`);
const response = await fetch(manifestUrl, {});
let response;
for (let attempt = 1; attempt <= MANIFEST_FETCH_ATTEMPTS; attempt++) {
info2(`Fetching manifest data from ${manifestUrl} ...`);
try {
response = await fetch(manifestUrl, {});
break;
} catch (error2) {
if (attempt >= MANIFEST_FETCH_ATTEMPTS) {
throw error2;
}
const delayMs = 1e3 * 2 ** (attempt - 1);
info2(`Manifest fetch failed; retrying in ${delayMs}ms ...`);
await new Promise((resolve) => setTimeout(resolve, delayMs));
}
}
if (response === void 0) {
throw new Error("Manifest fetch attempts exhausted.");
}
if (!response.ok) {
throw new Error(
`Failed to fetch manifest data: ${response.status} ${response.statusText}`