Skip to main content

Function: retry()

retry<T>(cb: () => Awaitable<T>, retries: number): Promise<T>

Asynchronously calls the callback function until it either succeeds or it runs out of retries. For a synchronous variant, see retrySync.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
cb() => Awaitable<T>The function to be retried is passed in as a callback function.
retriesnumberThe number of retries is also passed in as a parameter. Minimum of 0.

Returns

Promise<T>

The result of the callback function is returned.

Defined in

retry.ts:10