MCPcopy
hub / github.com/goenning/google-indexing-script / fetchRetry

Function fetchRetry

src/shared/utils.ts:38–52  ·  view source on GitHub ↗
(url: string, options: RequestInit, retries: number = 5)

Source from the content-addressed store, hash-verified

36 * @throws Error when retries are exhausted or server error occurs.
37 */
38export async function fetchRetry(url: string, options: RequestInit, retries: number = 5) {
39 try {
40 const response = await fetch(url, options);
41 if (response.status >= 500) {
42 const body = await response.text();
43 throw new Error(`Server error code ${response.status}\n${body}`);
44 }
45 return response;
46 } catch (err) {
47 if (retries <= 0) {
48 throw err;
49 }
50 return fetchRetry(url, options, retries - 1);
51 }
52}

Callers 5

getSitesFunction · 0.90
getPageIndexingStatusFunction · 0.90
getPublishMetadataFunction · 0.90
requestIndexingFunction · 0.90
getSitemapsListFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected