Gathering detailed insights and metrics for run-queue
Gathering detailed insights and metrics for run-queue
Gathering detailed insights and metrics for run-queue
Gathering detailed insights and metrics for run-queue
A promise based, dynamic priority queue runner, with concurrency limiting.
npm install run-queue
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
ISC License
68 Stars
23 Commits
5 Forks
1 Watchers
1 Branches
3 Contributors
Updated on Jul 11, 2025
Latest Version
2.0.1
Package Id
run-queue@2.0.1
Size
2.89 kB
NPM Version
6.6.0
Node Version
10.11.0
Published on
Jan 26, 2019
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
2
A promise based, dynamic priority queue runner, with concurrency limiting.
1const RunQueue = require('run-queue') 2 3const queue = new RunQueue({ 4 maxConcurrency: 1 5}) 6 7queue.add(1, example, [-1]) 8for (let ii = 0; ii < 5; ++ii) { 9 queue.add(0, example, [ii]) 10} 11const finished = [] 12queue.run().then( 13 console.log(finished) 14}) 15 16function example (num, next) { 17 setTimeout(() => { 18 finished.push(num) 19 next() 20 }, 5 - Math.abs(num)) 21}
would output
[ 0, 1, 2, 3, 4, -1 ]
If you bump concurrency to 2
, then you get:
[ 1, 0, 3, 2, 4, -1 ]
The concurrency means that they don't finish in order, because some take
longer than others. Each priority level must finish entirely before the
next priority level is run. See
PRIORITIES below. This is
even true if concurrency is set high enough that all of the regular queue
can execute at once, for instance, with maxConcurrency: 10
:
[ 4, 3, 2, 1, 0, -1 ]
Create a new queue. Options may contain:
1
) The maximum number of jobs to execute at once.Add a new job to the end of the queue at priority prio
that will run fn
with args
. If fn
is async then it should return a Promise.
Start running the job queue. Returns a Promise that resolves when either all the jobs are complete or a job ends in error (throws or returns a rejected promise). If a job ended in error then this Promise will be rejected with that error and no further queue running will be done.
Priorities are any integer value >= 0.
Lowest is executed first.
Priorities essentially represent distinct job queues. All jobs in a queue must complete before the next highest priority job queue is executed.
This means that if you have two queues, 0
and 1
then ALL jobs in 0
must complete before ANY execute in 1
. If you add new 0
level jobs
while 1
level jobs are running then it will switch back processing the 0
queue and won't execute any more 1
jobs till all of the new 0
jobs
complete.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 2/23 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
50 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More