@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) • 952 B
TypeScript
/**
* @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 ExponentialBackoffPolicySettings = {
/**
* @default 60_000 milliseconds
*/
maxDelay?: TimeSpan;
/**
* @default 1_000 milliseconds
*/
minDelay?: TimeSpan;
/**
* @default 2
*/
multiplier?: number;
/**
* @default 0.5
*/
jitter?: number;
/**
* @internal
* Should only be used for testing
*/
_mathRandom?: () => number;
};
/**
* Exponential backoff policy with jitter
*
* IMPORT_PATH: `"@daiso-tech/core/async"`
* @group BackoffPolicies
*/
export declare function exponentialBackoffPolicy(settings?: DynamicBackoffPolicy<ExponentialBackoffPolicySettings>): BackoffPolicy;