Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use tsdoc comments for hover/completion hints #48

Merged
merged 1 commit into from
May 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 31 additions & 8 deletions src/retry-promise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,51 @@
import {timeout} from "./timeout";

export interface RetryConfig<T = any> {
// number of maximal retry attempts (default: 10)
/**
* number of maximal retry attempts
* @defaultValue 10
*/
retries: number | "INFINITELY";

// wait time between retries in ms (default: 100)
/**
* wait time between retries in ms
* @defaultValue 100
*/
delay: number;

// check the result, will retry until true (default: () => true)
/**
* check the result, will retry until true
* @defaultValue () => true
*/
until: (t: T) => boolean;

// log events (default: () => undefined)
/**
* log events
* @defaultValue () => undefined
*/
logger: (msg: string) => void;

// overall timeout in ms (default: 60 * 1000)
/**
* overall timeout in ms
* @defaultValue 60 * 1000
*/
timeout: number | "INFINITELY";

// increase delay with every retry (default: "FIXED")
/**
* increase delay with every retry
* @defaultValue "FIXED"
*/
backoff: "FIXED" | "EXPONENTIAL" | "LINEAR" | ((attempt: number, delay: number) => number);

// maximal backoff in ms (default: 5 * 60 * 1000)
/**
* maximal backoff in ms
* @defaultValue 5 * 60 * 1000
*/
maxBackOff: number;

// allows to abort retrying for certain errors
/**
* allows to abort retrying for certain errors
*/
retryIf: (error: any) => boolean
}

Expand Down