@ynhcj/xiaoyi-channel 0.0.92-beta → 0.0.93-beta
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.
- package/dist/src/provider.js +6 -5
- package/package.json +1 -1
package/dist/src/provider.js
CHANGED
|
@@ -23,12 +23,13 @@ function isRetryableProviderError(message) {
|
|
|
23
23
|
return true;
|
|
24
24
|
return false;
|
|
25
25
|
}
|
|
26
|
-
/** Compute retry delay in ms for the given 1-based attempt. */
|
|
26
|
+
/** Compute retry delay in ms for the given 1-based attempt, with up to 10s jitter. */
|
|
27
27
|
function getRetryDelayMs(attempt) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
const base = attempt <= RETRY_DELAYS_MS.length
|
|
29
|
+
? RETRY_DELAYS_MS[attempt - 1]
|
|
30
|
+
: RETRY_DELAYS_MS[RETRY_DELAYS_MS.length - 1];
|
|
31
|
+
const jitter = Math.floor(Math.random() * 10_000);
|
|
32
|
+
return base + jitter;
|
|
32
33
|
}
|
|
33
34
|
function sleep(ms) {
|
|
34
35
|
return new Promise((resolve) => setTimeout(resolve, ms));
|