keq 2.6.1 → 2.6.2
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [2.6.2](https://github.com/keq-request/keq/compare/v2.6.1...v2.6.2) (2024-05-29)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* retryDelay option setting is invaild ([9bc07f8](https://github.com/keq-request/keq/commit/9bc07f8c1d870c51f1c1013dd12e038e278884e3))
|
|
11
|
+
|
|
5
12
|
## [2.6.1](https://github.com/keq-request/keq/compare/v2.6.0...v2.6.1) (2024-05-28)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -7,12 +7,13 @@ export function retryMiddleware() {
|
|
|
7
7
|
const retryTimes = Number.isInteger(ctx.options.retryTimes)
|
|
8
8
|
? ctx.options.retryTimes + 1
|
|
9
9
|
: 1;
|
|
10
|
+
const delayOptions = ctx.options.retryDelay;
|
|
10
11
|
const retryDelay = async (attempt, error, ctx) => {
|
|
11
|
-
if (typeof
|
|
12
|
-
return
|
|
12
|
+
if (typeof delayOptions === 'function') {
|
|
13
|
+
return delayOptions(attempt, error, ctx);
|
|
13
14
|
}
|
|
14
|
-
else if (typeof
|
|
15
|
-
return
|
|
15
|
+
else if (typeof delayOptions === 'number') {
|
|
16
|
+
return delayOptions;
|
|
16
17
|
}
|
|
17
18
|
return 0;
|
|
18
19
|
};
|
|
@@ -19,12 +19,13 @@
|
|
|
19
19
|
const retryTimes = Number.isInteger(ctx.options.retryTimes)
|
|
20
20
|
? ctx.options.retryTimes + 1
|
|
21
21
|
: 1;
|
|
22
|
+
const delayOptions = ctx.options.retryDelay;
|
|
22
23
|
const retryDelay = async (attempt, error, ctx) => {
|
|
23
|
-
if (typeof
|
|
24
|
-
return
|
|
24
|
+
if (typeof delayOptions === 'function') {
|
|
25
|
+
return delayOptions(attempt, error, ctx);
|
|
25
26
|
}
|
|
26
|
-
else if (typeof
|
|
27
|
-
return
|
|
27
|
+
else if (typeof delayOptions === 'number') {
|
|
28
|
+
return delayOptions;
|
|
28
29
|
}
|
|
29
30
|
return 0;
|
|
30
31
|
};
|