Skip to content

retry

retry<T>(params): Promise<T>

Defined in: async/retry/index.ts:24

Retries an async function with configurable backoff strategy.

T

RetryParams<T>

The parameters object

Promise<T>

The result of the first successful call

const data = await retry({ fn: () => fetch("/api"), attempts: 5, backoff: "exponential" });

retry on failure, exponential backoff, resilient call, auto retry

Error if fn is not a function

The last error if all attempts fail