humanbehavior-js
Version:
SDK for HumanBehavior session and event recording
42 lines • 1.22 kB
TypeScript
/**
* Generates a jittered exponential backoff delay in milliseconds
*
* The base value is 3 seconds, which is doubled with each retry
* up to the maximum of 30 minutes
*
* Each value then has +/- 50% jitter
*
* Giving a range of 3 seconds up to 45 minutes
*/
export declare function pickNextRetryDelay(retriesPerformedSoFar: number): number;
export interface RetriableRequestOptions {
url: string;
method?: string;
headers?: Record<string, string>;
body?: string | Blob;
retriesPerformedSoFar?: number;
estimatedSize?: number;
callback?: (response: {
statusCode: number;
text: string;
json?: any;
}) => void;
}
export declare class RetryQueue {
private _isPolling;
private _poller;
private _pollIntervalMs;
private _queue;
private _areWeOnline;
private _sendRequest;
constructor(sendRequest: (options: RetriableRequestOptions) => Promise<void>);
get length(): number;
retriableRequest(options: RetriableRequestOptions): Promise<void>;
private _shouldRetry;
private _enqueue;
private _poll;
private _flush;
unload(): void;
private _sendBeaconRequest;
}
//# sourceMappingURL=retry-queue.d.ts.map