You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Javascript module to perform ***async flow control*** on collection/iterable/dictionary ***in parallel*** and make ***retry easily*** when error occurred
6
+
Javascript module to perform ***async flow control*** on collection/iterable/dictionary ***in controlled parallel*** and make ***retry easily*** when error occurred
7
+
8
+
## Features ##
9
+
- iterate collection (array/object/iterator) and ***run async function on each item*** in a collection
10
+
- control the ***concurrency*** of running async function on the items
11
+
-***auto retry*** when error occurred
12
+
-***delayed retry***
7
13
8
14
## Install ##
9
-
```
10
-
npm install async-parallel-foreach --save
15
+
```bash
16
+
npm install async-parallel-foreach async --save
11
17
or
12
-
yarn add async-parallel-foreach
18
+
yarn add async-parallel-foreach async
13
19
```
14
20
15
21
## How to use this module in your project? ##
16
22
Frontend: used in framework like React, Angular, Vue etc
- coll - can be Array, Object (dictionary), Iterable
28
37
- parallelLimit - number of iteratee functions to be executed in parallel at any time, set `parallelLimit = -1` for unlimited parallelization (all items will start process at once)
29
38
- iteratee - the function that you define to process each item in "coll"
39
+
- if "coll" is array, it will call with (value, index)
40
+
- if "coll" is object, it will call with (value, key)
30
41
- eachMaxTry - maximum number of times each item will be processed by "iteratee".
31
42
- if `eachMaxTry = 2`, then the item will be retried 1 time when there is error throwed in the iteratee function
32
43
- add delay before retry
33
44
- set `eachMaxTry = { times: 2, interval: 1000 }` // wait for 1000 ms before retry
34
45
- interval can also accept function returning the interval in ms
35
46
- e.g. `eachMaxTry = { times: 2, interval: (retryCount) => retryCount * 1000 }` // retryCount start from 2 which means it is the 2nd trial
36
-
- eachMaxTry follows the "opts" argument in [https://caolan.github.io/async/docs.html#retry](https://caolan.github.io/async/docs.html#retry) "retry"
0 commit comments