MCPcopy Create free account
hub / github.com/cloudflare/templates / fetchWithRetries

Function fetchWithRetries

cli/src/util.ts:410–423  ·  view source on GitHub ↗
(...args)

Source from the content-addressed store, hash-verified

408}
409
410export const fetchWithRetries: typeof fetch = async (...args) => {
411 const maxRetries = 3;
412 for (let numRetries = 0; numRetries < maxRetries; numRetries++) {
413 try {
414 return fetch(...args);
415 } catch (err) {
416 if (numRetries === maxRetries - 1) {
417 throw err;
418 }
419 await new Promise((resolve) => setTimeout(resolve, numRetries * 5_000));
420 }
421 }
422 throw new Error("Max retries reached."); // this should be unreachable
423};

Callers 9

getFilesFunction · 0.90
getPackageJSONFunction · 0.90
getLatestPackageVersionFunction · 0.90
uploadTemplatesFunction · 0.90
commentOnPRFunction · 0.85
isDuplicateCommentFunction · 0.85
createPRFunction · 0.85
getPRByBranchFunction · 0.85
getLatestPackageVersionFunction · 0.85

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected