async-promise-queue
A wrapper around the async
module, that provides an improved promise queue.
Some highlights:
- promiseified method (all wired up)
- in a failure scenario, it will wait for pending work before rejecting. This prevents the run-away work problem.
Usage
npm install async-promise-queue
or
yarn add async-promise-queue
Debug logging
DEBUG="async-promise-queue*" node <your program>
And you will be informed when a queue is used, and what its concurrency becomes (note: we can always add more logging, submit your ideas as pull requests!)
Example
'use strict'; const queue = ; queueasync // a reference to the `async` module which `async-promise-queue` is requiring. // the example workerconst worker = queueasync; // the workconst work = file:'/path-1' duration: 1000 file:'/path-2' duration: 50 file:'/path-3' duration: 100 file:'/path-4' duration: 50 ; // calling our queue helper