Registry / devops / fqueue

fqueue

JSON →
library0.0.0jsnpmunverified

In-memory function queue with error handling, retry capabilities, and throttling of simultaneous executions. Version 0.0.0 targets Node >=0.4.x and is an early, likely unstable release. It provides a FunctionQueue class inheriting from EventEmitter, with options for concurrency control (maxPending), retry attempts (maxAttempts), and attempt timeout. Compared to modern queue libraries like p-queue or bull, fqueue is minimal, has no dependencies, and offers manual done/error signaling rather than promise-based flow. Last updated in 2012, it should be considered exploratory code.

npm install fqueue
INSTALL
IMPORT
SIG · FQUEUE
F
fqueue
devopsjavascriptv0.0.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.

FunctionQueue
var FunctionQueue = require('fqueue').FunctionQueue;
import { FunctionQueue } from 'fqueue';
CommonJS only; no default export; use require with .FunctionQueue
fqueue (default)
var fqueue = require('fqueue');
import fqueue from 'fqueue';
No default export; require returns an object with FunctionQueue property
FunctionQueue type
const FunctionQueue: any = require('fqueue').FunctionQueue;
import type { FunctionQueue } from 'fqueue';
No TypeScript types; use any or manual type declarations

Creates a FunctionQueue with concurrency and retry settings, starts a task that errors twice then succeeds, and listens for events.

var FunctionQueue = require('fqueue').FunctionQueue; var queue = new FunctionQueue({ maxPending: 2, maxAttempts: 3 }); var count = 0; function task(cb) { count++; console.log('Executing task', count); if (count < 3) { queue.error(new Error('Simulated error'), task, []); } else { queue.done(); } } queue.on('error', function(err) { console.error('Final error:', err); }); queue.on('done', function() { console.log('All done'); }); queue.start(task, []);
Debug
Known issues
gotchaCalling .done() is required even after .error() to signal task completion; omitting it hangs the queue.
fix
Always call queue.done() after queue.error() completes.
affects: >=0.0.0
gotchamaxAttempts defaults to 3; set to 0 to disable retries, -1 for infinite retries.
fix
Explicitly set maxAttempts: 0 if retries are not desired.
affects: >=0.0.0
gotchaThe queue does not support promises; all callbacks must be manually managed with .done() and .error().
fix
Wrap async functions with manual done/error invocation.
affects: >=0.0.0
gotchaScope option defaults to 'this' (the queue), which may cause unexpected behavior for standalone functions.
fix
Pass an explicit scope option when creating the queue or calling start/enqueue.
affects: >=0.0.0
gotchaNo TypeScript declarations; using in TypeScript requires manual type definitions.
fix
Create a .d.ts file or use any type.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: queue.start is not a function
Required module incorrectly: got default export object instead of FunctionQueue constructor.
fix
Use var FunctionQueue = require('fqueue').FunctionQueue; then new FunctionQueue(options);
Error: done() called without pending task
Called .done() when no task was running or after queue completed.
fix
Ensure .done() is called exactly once per started task.
Upgrade
Version history
0.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
packagefqueue
fqueue — npm install fqueue · libregistry