MCPcopy Index your code
hub / github.com/nodejs/nodejs.org / attemptFetch

Function attemptFetch

apps/site/next.fetch.mjs:28–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26 const backoff = Math.max(0, Number(delay) || 0);
27
28 const attemptFetch = attempt =>
29 fetch(url, { ...options, signal: AbortSignal.timeout(30000) }).catch(e => {
30 if (attempt === retries || !isTimeoutError(e)) {
31 throw e;
32 }
33
34 return sleep(backoff * attempt).then(() => attemptFetch(attempt + 1));
35 });
36
37 return attemptFetch(1);
38};

Callers 1

fetchWithRetryFunction · 0.85

Calls 3

fetchFunction · 0.85
isTimeoutErrorFunction · 0.85
sleepFunction · 0.85

Tested by

no test coverage detected