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) 944 B
/** * @module Async */ import { TimeSpan } from "../../../utilities/_module-exports.js"; import type { BackoffPolicy, DynamicBackoffPolicy } 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; /** * @internal * Should only be used for testing */ _mathRandom?: () => number; }; /** * Polynomial backoff policy with jitter * * IMPORT_PATH: `"@daiso-tech/core/async"` * @group BackoffPolicies */ export declare function polynomialBackoffPolicy(settings?: DynamicBackoffPolicy<PolynomialBackoffPolicySettings>): BackoffPolicy;