mftsccs-node 0.0.82-dev → 0.0.85-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Services/Http/RetryWithBackoff
|
|
3
|
+
* @description Retries an operation with exponential backoff when it throws or
|
|
4
|
+
* reports a non-ok result. Intended for calls that can fail transiently due to
|
|
5
|
+
* backend contention (e.g. reserved ID/connection ID reservation under heavy
|
|
6
|
+
* write load) rather than because the requested resource is genuinely absent.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Retries an async operation with exponential backoff.
|
|
10
|
+
*
|
|
11
|
+
* @param operation - Function returning a promise that resolves to an object
|
|
12
|
+
* with an `ok` boolean, or rejects on failure
|
|
13
|
+
* @param maxAttempts - Total attempts including the first (default 3)
|
|
14
|
+
* @param baseDelayMs - Delay before the first retry; doubles each subsequent attempt (default 300ms)
|
|
15
|
+
* @returns The last result if it never became `ok`, or throws the last error if every attempt threw
|
|
16
|
+
*/
|
|
17
|
+
export declare function withBackoffRetry<T extends {
|
|
18
|
+
ok: boolean;
|
|
19
|
+
}>(operation: () => Promise<T>, maxAttempts?: number, baseDelayMs?: number): Promise<T>;
|