
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
async-task-queue-runner
Advanced tools
This module allows you to run the queue of the asymynchronous tasks in the form of a queue (so far parallel).
This module allows you to run the queue of the asynchronous tasks in the form of a queue (so far parallel).
npm i async-task-queue-runner
function runTasks() {
return new Promise((resolve, reject) => {
let queue = new TaskQueue();
let tasks = [ taskFactory(500), taskFactory(300), taskFactory(100) ];
let completeTask = 0;
tasks.forEach((task, index) => {
let runTask = () => {
return task.then(result => {
console.log("task result", result);
++completeTask;
if (completeTask == tasks.length) {
console.log("all tasks complete");
resolve();
};
}).catch(err => {
console.log("task end with error");
reject(err);
})
};
queue.addTask(runTask);
});
};
};
function taskFactory(duration=1000, isSuccess=true) {
return new Promise((resolve, reject) => {
setTimeout(() => {
if (isSuccess) resolve("success");
else reject("error");
}, duration);
});
};
function runTasks() {
let tasks = [ taskFactory.bind(null, 500), taskFactory.bind(null, 300), taskFactory.bind(null, 100) ];
let success = (result, inx) => {
console.log("task index - ", inx, ".Task result - ", result);
};
return runner(tasks)(success);
};
function taskFactory(duration=1000, isSuccess=true) {
return new Promise((resolve, reject) => {
setTimeout(() => {
if (isSuccess) resolve("success");
else reject("error");
}, duration);
});
};
The module allows you to run asynchronous tasks in parallel
it's a task queue class.
limit - number of tasks that run simultaneously in parallel. Default 0 (running all tasks in parallel).
It's method push task into queue.
Call the next task. In the existing queue, it is called automatically.
The function that creates the queue and allows you to add the necessary handlers to each task in a given context.
tasks - array of asynchronous tasks.
limit - number of tasks that run simultaneously in parallel. Default 0 (running all tasks in parallel). Optional.
retryCount - number of attempts to complete the task, if it was completed with an error. Default 0 (without attempting to perform task again). Optional.
success - success function like a promise success function. Optional.
error - error function like a promise success function. Optional.
context - context for success and error function. Optional.
MIT © nlapshin
FAQs
This module allows you to run the queue of the asymynchronous tasks in the form of a queue (so far parallel).
We found that async-task-queue-runner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.