@handy-common-utils/promise-utils 1.2.6 → 1.2.7
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/README.md +2 -2
- package/dist/promise-utils.d.ts +1 -1
- package/dist/promise-utils.js +1 -1
- package/package.json +2 -5
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ import { withRetry, inParallel, FIBONACCI_SEQUENCE, EXPONENTIAL_SEQUENCE } from
|
|
|
55
55
|
|
|
56
56
|
// withRetry(...)
|
|
57
57
|
const result = await withRetry(() => doSomething(), [100, 200, 300, 500, 800, 1000]);
|
|
58
|
-
const result2 = await withRetry(() => doSomething(), Array.from({length: 10}, (_v, i) => Math.min(FIBONACCI_SEQUENCE[i], 10)), err => err.statusCode === 429);
|
|
58
|
+
const result2 = await withRetry(() => doSomething(), Array.from({length: 10}, (_v, i) => 1000 * Math.min(FIBONACCI_SEQUENCE[i], 10)), err => err.statusCode === 429);
|
|
59
59
|
const result3 = await withRetry(() => doSomething(), attempt => attempt <= 8 ? 1000 * Math.min(EXPONENTIAL_SEQUENCE[attempt - 1], 10) : undefined, err => err.statusCode === 429);
|
|
60
60
|
statusCode === 429);
|
|
61
61
|
|
|
@@ -481,7 +481,7 @@ Do an operation repeatedly until a criteria is met.
|
|
|
481
481
|
```javascript
|
|
482
482
|
|
|
483
483
|
const result = await PromiseUtils.withRetry(() => doSomething(), [100, 200, 300, 500, 800, 1000]);
|
|
484
|
-
const result2 = await PromiseUtils.withRetry(() => doSomething(), Array.from({length: 10}, (_v, i) => Math.min(FIBONACCI_SEQUENCE[i], 10), err => err.statusCode === 429);
|
|
484
|
+
const result2 = await PromiseUtils.withRetry(() => doSomething(), Array.from({length: 10}, (_v, i) => 1000 * Math.min(FIBONACCI_SEQUENCE[i], 10), err => err.statusCode === 429);
|
|
485
485
|
const result3 = await PromiseUtils.withRetry(() => doSomething(), attempt => attempt <= 8 ? 1000 * Math.min(FIBONACCI_SEQUENCE[attempt - 1], 10) : undefined, err => err.statusCode === 429);
|
|
486
486
|
|
|
487
487
|
```
|
package/dist/promise-utils.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ export declare abstract class PromiseUtils {
|
|
|
64
64
|
*
|
|
65
65
|
* @example
|
|
66
66
|
* const result = await PromiseUtils.withRetry(() => doSomething(), [100, 200, 300, 500, 800, 1000]);
|
|
67
|
-
* const result2 = await PromiseUtils.withRetry(() => doSomething(), Array.from({length: 10}, (_v, i) => Math.min(FIBONACCI_SEQUENCE[i], 10), err => err.statusCode === 429);
|
|
67
|
+
* const result2 = await PromiseUtils.withRetry(() => doSomething(), Array.from({length: 10}, (_v, i) => 1000 * Math.min(FIBONACCI_SEQUENCE[i], 10), err => err.statusCode === 429);
|
|
68
68
|
* const result3 = await PromiseUtils.withRetry(() => doSomething(), attempt => attempt <= 8 ? 1000 * Math.min(FIBONACCI_SEQUENCE[attempt - 1], 10) : undefined, err => err.statusCode === 429);
|
|
69
69
|
*
|
|
70
70
|
* @template Result type of the operation result
|
package/dist/promise-utils.js
CHANGED
|
@@ -81,7 +81,7 @@ class PromiseUtils {
|
|
|
81
81
|
*
|
|
82
82
|
* @example
|
|
83
83
|
* const result = await PromiseUtils.withRetry(() => doSomething(), [100, 200, 300, 500, 800, 1000]);
|
|
84
|
-
* const result2 = await PromiseUtils.withRetry(() => doSomething(), Array.from({length: 10}, (_v, i) => Math.min(FIBONACCI_SEQUENCE[i], 10), err => err.statusCode === 429);
|
|
84
|
+
* const result2 = await PromiseUtils.withRetry(() => doSomething(), Array.from({length: 10}, (_v, i) => 1000 * Math.min(FIBONACCI_SEQUENCE[i], 10), err => err.statusCode === 429);
|
|
85
85
|
* const result3 = await PromiseUtils.withRetry(() => doSomething(), attempt => attempt <= 8 ? 1000 * Math.min(FIBONACCI_SEQUENCE[attempt - 1], 10) : undefined, err => err.statusCode === 429);
|
|
86
86
|
*
|
|
87
87
|
* @template Result type of the operation result
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@handy-common-utils/promise-utils",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "Promise related utilities",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"pretest": "eslint . --ext .ts",
|
|
@@ -39,8 +39,5 @@
|
|
|
39
39
|
"utilities"
|
|
40
40
|
],
|
|
41
41
|
"author": "James Hu",
|
|
42
|
-
"license": "Apache-2.0"
|
|
43
|
-
"dependencies": {
|
|
44
|
-
"-": "^0.0.1"
|
|
45
|
-
}
|
|
42
|
+
"license": "Apache-2.0"
|
|
46
43
|
}
|