Security News
Highlights from the 2024 Rails Community Survey
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
queue-promise
Advanced tools
$ npm install queue-promise
import Queue from "queue-promise";
const q = new Queue( {
concurrency : 1,
interval : 2000
} );
q.on( "resolve", data => console.log( data ) );
q.on( "reject", error => console.error( error ) );
q.add( asyncTaskA ); // resolved/rejected after 0s
q.add( asyncTaskB ); // resolved/rejected after 2s
q.add( asyncTaskC ); // resolved/rejected after 4s
q.add( asyncTaskD ); // resolved/rejected after 6s
q.start();
new Queue( options )
Create a new Queue
instance with optionally injected options.
Option | Default | Description |
---|---|---|
concurrency | 5 | How many promises can be handled at the same time |
interval | 500 | How often should new promises be handled (in ms) |
.add( promise )
Adds a promise to the queue.
.start()
Starts the queue.
.stop()
Stops the queue.
.next()
Goes to the next request and stops the loop if there is no requests left.
.on( event, callback )
Sets a callback
for an event
. You can set callback for those events: start
, stop
, tick
, resolve
, reject
, end
.
FAQs
A simple, dependency-free library for concurrent promise-based queues. Comes with with concurrency and timeout control.
The npm package queue-promise receives a total of 15,341 weekly downloads. As such, queue-promise popularity was classified as popular.
We found that queue-promise 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
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.