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) 950 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 PolynomialBackoffPolicySettings = { /** * @default 60_000 milliseconds */ maxDelay?: TimeSpan; /** * @default 1_000 milliseconds */ minDelay?: TimeSpan; /** * @default {2} */ degree?: number; /** * @default {0.5} */ jitter?: number; /** * Used only for testing * @internal */ _mathRandom?: () => number; }; /** * Polynomial backoff policy with jitter * * IMPORT_PATH: `"@daiso-tech/core/async"` * @group BackoffPolicies */ export declare function polynomialBackoffPolicy(settings?: PolynomialBackoffPolicySettings | ((error: unknown) => PolynomialBackoffPolicySettings)): BackoffPolicy;