rpc_ts
Version:
Remote Procedure Calls in TypeScript made simple
26 lines (25 loc) • 755 B
TypeScript
/**
* Simple exponential backoff strategy.
*
* @module ModuleRpcClient
*
* @license
* Copyright (c) Aiden.ai
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** Options for an exponential backoff. */
export interface BackoffOptions {
exponentialBackoffBase: number;
constantBackoffMs: number;
maxBackoffMs: number;
maxRetries: number;
}
/** Default options for an exponential backoff. */
export declare const DEFAULT_BACKOFF_OPTIONS: BackoffOptions;
/**
* Gets the number of milliseconds to elapse for a given number of retries
* and a backoff schedule.
*/
export declare function getBackoffMs(options: BackoffOptions, retries: number): number;