Registry / devops / concurrent-queue

concurrent-queue

JSON →
library7.0.2jsnpmunverified

A FIFO queue with concurrency control for Node.js and browsers, version 7.0.2. Supports both callback and promise-based processing with configurable concurrency limits, max queue size, and soft limits. It uses eventuate for event handling. The package is stable with no recent releases, suitable for rate-limiting async tasks.

npm install concurrent-queue
INSTALL
IMPORT
SIG · CONCURRENT-QUEUE
C
concurrent-queue
devopsjavascriptv7.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

concurrentQueue
import concurrentQueue from 'concurrent-queue'
const { concurrentQueue } = require('concurrent-queue')
Default export; CommonJS require returns the function directly.
Queue
import type { Queue } from 'concurrent-queue'
import { Queue } from 'concurrent-queue'
TypeScript users: Queue type is exported for typing the queue instance.
LimitObject
import type { LimitObject } from 'concurrent-queue'
Use for TypeScript type annotations for .limit() argument.

Creates a queue with concurrency limit 2, processes tasks with a 1s delay, and logs start/complete.

import cq from 'concurrent-queue'; const queue = cq() .limit({ concurrency: 2 }) .process((task: string) => { console.log(`${task} started`); return new Promise((resolve) => { setTimeout(() => resolve(task), 1000); }); }); for (let i = 1; i <= 10; i++) { queue(`task ${i}`).then((result) => { console.log(`${result} done`); }); }
Debug
Known issues
breakingVersion 7.0.0 dropped support for Node.js <10 and removed callback-only API? Verify if callback signature changed.
fix
Use promises or upgrade to Node 10+. If using callbacks, ensure two arguments to queue().
affects: >=7.0.0
gotchaWhen using callbacks, the queue() method returns undefined (not the promise).
fix
Use promise if you need to await completion, or provide callback as second argument.
affects: >=7.0.0
gotcha.process() must be called before queueing items; otherwise items will never complete.
fix
Call process() before pushing items.
affects: >=1.0.0
deprecatedThe `.enqueued()`, `.rejected()`, and `.softLimitReached()` methods return eventuate consumers; these may be deprecated in favor of direct eventuate API in future.
fix
Check documentation for eventuate usage.
affects: >=6.0.0
Errors
Common errors & fixes
TypeError: queue is not a function
Using default import incorrectly with CommonJS require.
fix
Use 'const cq = require('concurrent-queue')' without destructuring.
Error: maxSize exceeded
Queued more items than the maxSize limit allows.
fix
Increase maxSize or ensure items are processed before adding more.
UnhandledPromiseRejectionWarning: Error: queue cannot process items before limit is set
Calling queue() before setting a concurrency limit via .limit().
fix
Call .limit({ concurrency: N }) before enqueueing items.
Upgrade
Version history
7.0.2latest on npm
Audit
Dependencies
eventuaterequiredUsed for enqueued/rejected/softLimitReached events
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources