Registry / testing / fc-queue

fc-queue

JSON →
library0.7.0jsnpmunverified

A lightweight async queue for managing request concurrency with promise-based flow control. v0.7.0 is the latest stable release with infrequent updates. It supports configurable concurrency limits, task retries, and priority queuing. Unlike alternatives like p-limit, it offers built-in retry logic and event-based progress tracking, but lacks extensive ecosystem adoption.

npm install fc-queue
INSTALL
IMPORT
SIG · FC-QUEUE
F
fc-queue
testingjavascriptv0.7.0
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.

Queue
import { Queue } from 'fc-queue'
const Queue = require('fc-queue')
ESM-only package; CommonJS require will fail or need dynamic import.
Task
import type { Task } from 'fc-queue'
import { Task } from 'fc-queue'
Task is a type-only export; use 'import type' for TypeScript to avoid runtime errors.
QueueEvents
import { Queue, QueueEvents } from 'fc-queue'
import Queue from 'fc-queue'
QueueEvents is a named export alongside Queue; default import does not include it.

Creates a queue with limited concurrency and retries, adds multiple async tasks, and logs their completion.

import { Queue } from 'fc-queue'; const queue = new Queue({ concurrency: 2, retries: 3 }); queue.on('completed', (result) => console.log('Task completed:', result)); async function main() { const tasks = [1, 2, 3].map(n => () => fetch(`https://api.example.com/data/${n}`)); const results = await queue.addAll(tasks); console.log('All results:', results); } main().catch(console.error);
Debug
Known issues
gotchaQueue instance methods are not bound to the instance when destructured.
fix
Always call methods on the queue instance, e.g., queue.add(task) not const { add } = queue.
affects: >=0.0.0
gotchaCalling addAll with an empty array resolves immediately with an empty array, which might skip intended processing.
fix
Check array length before calling addAll or handle empty results explicitly.
affects: >=0.0.0
deprecatedThe 'retryDelay' option is deprecated in v0.7.0 and will be removed in the next major release.
fix
Use 'retryDelays' (array of delays) instead of a single fixed delay.
affects: =0.7.0
gotchaEvent listeners added before calling start may not receive events from tasks added via addAll.
fix
Add event listeners after the queue is started or use the 'started' event to set up listeners.
affects: >=0.5.0
Errors
Common errors & fixes
TypeError: queue.addAll is not a function
Incorrect import or use of a version before addAll was introduced (pre-0.6.0).
fix
Upgrade to fc-queue@>=0.6.0 and use named import: import { Queue } from 'fc-queue'.
Error: Cannot find module 'fc-queue'
Package not installed or wrong import path.
fix
Run 'npm install fc-queue' and ensure import path is 'fc-queue' (no subpath).
TypeError: this is undefined in queue method
Destructuring a method loses the 'this' context.
fix
Call method on the instance: queue.add(task) instead of const { add } = queue; add(task).
Unhandled Promise Rejection: Error: Task failed after 3 retries
Default retries (3) exceeded. Task keeps failing.
fix
Increase retries or fix the task logic; handle rejection via queue.on('failed', ...).
Upgrade
Version history
0.7.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
fc-queue — npm install fc-queue · libregistry