retry
Retries a promise-returning function up to maxAttempts times
Available since v1.9.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
fn | function | The function to retry |
maxAttempts | number | Maximum number of attempts |
delayMs | number | Delay between attempts in milliseconds |
Returns
Section titled “Returns”Promise<T> — Promise that resolves with the result or rejects with the last error
Examples
Section titled “Examples”Retry a failing function
Section titled “Retry a failing function”Retries the function up to maxAttempts times before giving up.
