UNPKG

@daiso-tech/core

Version:

The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.

41 lines (40 loc) 959 B
/** * @module Async */ import { TimeSpan } from "../../../utilities/_module-exports.js"; import type { BackoffPolicy } from "../../../async/backof-policies/_shared.js"; /** * * IMPORT_PATH: `"@daiso-tech/core/async"` * @group BackoffPolicies */ export type ExponentialBackoffPolicySettings = { /** * @default 60_000 milliseconds */ maxDelay?: TimeSpan; /** * @default 1_000 milliseconds */ minDelay?: TimeSpan; /** * @default {2} */ multiplier?: number; /** * @default {0.5} */ jitter?: number; /** * Used only for testing * @internal */ _mathRandom?: () => number; }; /** * Exponential backoff policy with jitter * * IMPORT_PATH: `"@daiso-tech/core/async"` * @group BackoffPolicies */ export declare function exponentialBackoffPolicy(settings?: ExponentialBackoffPolicySettings | ((error: unknown) => ExponentialBackoffPolicySettings)): BackoffPolicy;