/** The waits before the three retries of a transient failure (D-20). */ export declare const RETRY_WAITS_MS: readonly number[]; /** * A failure of the database that can go away by itself (D-20). A constraint (class * 23), bad data (class 22) and the rest fail at once. */ export declare function isTransientDatabaseError(error: unknown): boolean; /** * A failure to fetch an image that can go away by itself (D-20): the connection * refused or reset, a DNS failure, a timeout, and the HTTP statuses 408, 425, * 429, 500, 502, 503 and 504. Another 4xx answer, a page that is not an image or * an image that is too large will be the same next time. */ export declare function isTransientImageError(error: unknown): boolean; export interface RetryOptions { isTransient: (error: unknown) => boolean; /** The Clock port's `sleep`. */ sleep: (ms: number) => Promise; /** Called before each wait, with the failure and the number of the retry. */ onRetry?: (error: unknown, retry: number) => void; /** When it is aborted, the failure is thrown at once and nobody waits. */ signal?: AbortSignal; } /** * Runs `work`. A transient failure is retried up to 3 times, after 1 s, 3 s and * 9 s (D-20), before it is thrown; any other failure is thrown at once. A row * that succeeds on a retry is a success. */ export declare function withRetries(work: () => Promise, options: RetryOptions): Promise;