diff --git a/plugin/src/utils/retried-fetch.ts b/plugin/src/utils/retried-fetch.ts index 474ead3..af4296a 100644 --- a/plugin/src/utils/retried-fetch.ts +++ b/plugin/src/utils/retried-fetch.ts @@ -1,4 +1,5 @@ import * as fetchRetryFactory from "fetch-retry"; +import { RequestInitRetryParams } from "fetch-retry"; import { Logger } from "src/tracing/logger"; const fetchWithRetry = fetchRetryFactory.default(fetch); @@ -15,10 +16,9 @@ function getUrlFromInput(input: RequestInfo | URL): string { export async function retriedFetch( input: RequestInfo | URL, - init: RequestInit = {} + init: RequestInitRetryParams = {} ): Promise { return fetchWithRetry(input, { - ...init, retryOn: function (attempt, error, response) { if (error !== null || !response || response.status >= 500) { Logger.getInstance().warn( @@ -33,5 +33,6 @@ export async function retriedFetch( }, retries: 6, retryDelay: (attempt) => Math.pow(1.5, attempt) * 500, + ...init, }); }