@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.
37 lines (36 loc) • 871 B
TypeScript
/**
* @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 LinearBackoffPolicySettings = {
/**
* @default 6000 milliseconds
*/
maxDelay?: TimeSpan;
/**
* @default 1_000 milliseconds
*/
minDelay?: TimeSpan;
/**
* @default {0.5}
*/
jitter?: number;
/**
* Used only for testing
* @internal
*/
_mathRandom?: () => number;
};
/**
* Linear backoff policy with jitter
*
* IMPORT_PATH: `"@daiso-tech/core/async"`
* @group BackoffPolicies
*/
export declare function linearBackoffPolicy(settings?: LinearBackoffPolicySettings | ((error: unknown) => LinearBackoffPolicySettings)): BackoffPolicy;