Registry / devops / mini-queue

mini-queue

JSON →
library0.0.14jsnpmunverified

mini-queue v0.0.14 is a lightweight in-memory job queue for Node.js (engine >=4). It provides a state machine for job lifecycle (new, queue, dequeue, process, complete, reject, cancel) with journaling of state transitions and timestamps. It supports grouping jobs by group and name, and limits journal length. The package is minimal with no external dependencies, suitable for simple queuing needs without persistence or distributed workers. Last updated in 2017-2018, it is in maintenance mode.

npm install mini-queue
INSTALL
IMPORT
SIG · MINI-QUEUE
M
mini-queue
devopsjavascriptv0.0.14
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.

default
import MiniQueue from 'mini-queue';
const MiniQueue = require('mini-queue');
The library is CommonJS but can be imported with ESM in Node >= 12 using default import transpilation.
MiniQueue
const MiniQueue = require('mini-queue');
const { MiniQueue } = require('mini-queue');
The module exports a single constructor function as module.exports, not a named export.
QueueJob
const QueueJob = require('mini-queue').QueueJob;
import { QueueJob } from 'mini-queue';
QueueJob is a property on the exported constructor; it is not exported as a named export in ESM.

Creates a MiniQueue instance with concurrency 2, creates a job with auto-start, and another manually queued job.

const MiniQueue = require('mini-queue'); const queue = new MiniQueue({ concurrency: 2, maxJournalLength: 10 }); queue.on('error', (err) => console.error(err)); queue.createJob({ group: 'mygroup', name: 'myname', process: (job, done) => { console.log('Processing job', job.id); done(null, 'result'); }, start: true }); // Or manually: const job = queue.createJob({ process: (job, done) => { console.log('Manual job', job.id); setTimeout(() => done(null, 'done'), 100); } }); queue.queueJob(job.id); queue.on('complete', (job) => { console.log('Job completed:', job.id, job.result); console.log('Journal entry:', job.journalEntry); console.log('Full journal:', JSON.stringify(queue.journal, null, 2)); });
Debug
Known issues
gotchaprocess function must call done() or job will hang forever.
fix
Ensure process callback invokes done(err, result) exactly once.
affects: >=0.0.0
gotchaJob IDs are numeric and auto-incremented globally across all queues.
fix
Use job.id as unique identifier; do not assume sequential ordering across groups.
affects: >=0.0.0
deprecatedThe package has not been updated since 2018; use at your own risk for production.
fix
Consider modern alternatives like Bull, Bee-Queue, or agenda.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: queue.createJob is not a function
Incorrect import style; the default export is a constructor not an object with createJob.
fix
Use 'const MiniQueue = require('mini-queue'); const queue = new MiniQueue();'
Error: Job already started
Calling queueJob on a job that is already queued or in process.
fix
Check job state before queuing or use the start: true option in createJob.
Upgrade
Version history
0.0.14latest on npm
Audit
Dependencies

No dependency data recorded yet.

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