Run N number of async tasks in parallel. As soon as one task is completed it will automatically schedule the next async task. Hence, it always runs N number of async tasks in parallel.
Optimum CPU utilisation.
Installation:
$ npm install async-train
How to use:
var train = ;{ // note that this function must be async console; process;}
use of mapConcurrentLimit:
mapConcurrentLimit takes array or objects as its first argument, second argument is limit and the third is async function on which all the objects are applied and the last one is callback which returns all the results after completing all tasks.
mapConcurrentLimit executes N tasks in parallel where N is the limit as shown in example.
{ var arr = ; var limit = 1000; forvar i=0;i<10000;i++ arr; train;}
use of mapConcurrent:
{ var arr = ; forvar i=0;i<10000;i++ arr; train;}
use of concurrentCallLimit:
concurrentCallLimit takes array of functions or tasks as its argument, second is limit , third is callback which returns all the results after completing all tasks.
concurrentCallLimit executes N tasks in parallel where N is the limit as shown in example.
{ var arr = ; var limit = 1000; forvar i=0;i<10000;i++ arr; train;}
use of concurrentCall:
concurrentCallLimit takes array of functions or tasks as its first argument, second argument is callback which returns all the results after completing all tasks.
concurrentCallLimit runs all tasks in parallel.
{ var arr = ; forvar i=0;i<10000;i++ arr; train;}