Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

run-queue

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

run-queue

A promise based, dynamic priority queue runner, with concurrency limiting.

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.8M
decreased by-1.04%
Maintainers
1
Weekly downloads
 
Created

What is run-queue?

The run-queue npm package is designed to manage and execute a queue of tasks with dependencies. It allows you to define tasks and their dependencies, ensuring that tasks are executed in the correct order.

What are run-queue's main functionalities?

Creating a Queue

This feature allows you to create a new queue with a specified maximum concurrency. The maxConcurrency option controls how many tasks can run simultaneously.

const RunQueue = require('run-queue');
const queue = new RunQueue({ maxConcurrency: 2 });

Adding Tasks to the Queue

This feature allows you to add tasks to the queue. Each task can have dependencies, which are specified as an array of task names that must be completed before the task can run.

queue.add('task1', [], () => console.log('Task 1 executed'));
queue.add('task2', ['task1'], () => console.log('Task 2 executed after Task 1'));
queue.add('task3', ['task1'], () => console.log('Task 3 executed after Task 1'));

Running the Queue

This feature allows you to run the queue. The callback function is called when all tasks have been completed or if an error occurs.

queue.run((err) => {
  if (err) console.error('Error running queue:', err);
  else console.log('All tasks completed successfully');
});

Other packages similar to run-queue

FAQs

Package last updated on 26 Jan 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc