Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Latest commit

 

History

History
29 lines (23 loc) · 1.13 KB

README.md

File metadata and controls

29 lines (23 loc) · 1.13 KB

queue-ts

GitHub license Travis codecov npm Commitizen friendly renovate badge

A promise based worker queue with limited concurrency.

Usage

// Create a queue with two worker threads
const queue = new Queue(2);
queue.onEmpty(() => {
  console.log('done');
});

// Adding tasks to do
queue.add(function task1() {});
queue.add(function task2() {});
queue.add(function task3() {});
queue.add(function task4() {});
queue.add(function task5() {});

The scheduled tasks will be executed but at most queue.concurrency task will be executed in parallel.