Registry / backend / timed-queue

timed-queue

JSON →
library1.4.0jsnpmunverified

Distributed timed job queue backed by Redis. Version 1.4.0 is current stable, last updated in 2019. It supports Redis cluster, multiple queues with prefix segregation, automatic scanning, retry and expiration of jobs. Key differentiators: designed for Node.js 6+, uses thunk-redis (callback/promise based, not modern async/await), and provides EventEmitter events for connection lifecycle and scan progress. It is a niche, low-maintenance library suitable for simple timed job scenarios but may lack modern features like persistence or advanced scheduling compared to Bull/BullMQ.

npm install timed-queue
INSTALL
IMPORT
SIG · TIMED-QUEUE
T
timed-queue
backendjavascriptv1.4.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.

TimedQueue
const TimedQueue = require('timed-queue')
import TimedQueue from 'timed-queue'
No ESM export; CommonJS only
queue
const q = timedQueue.queue('myqueue')
const q = new TimedQueue.Queue('myqueue')
queue is a method, not a constructor or static
addjob
queue.addjob('jobId', timestamp)(callback)
queue.addjob('jobId', timestamp).then(...)
addjob returns a thunk, not a Promise; call with callback or use thunkify

Initializes a timed queue, creates a queue named 'event', listens for jobs, and adds a job.

const TimedQueue = require('timed-queue'); const timedQueue = new TimedQueue({ prefix: 'TQ1', interval: 1000 * 60 }); timedQueue.connect() .on('connect', () => { const eventQueue = timedQueue.queue('event'); eventQueue.on('job', (jobObj) => { console.log('Processing job:', jobObj.job); eventQueue.ackjob(jobObj.job)(); }); // Add a job to execute 10 minutes before event start const eventStart = new Date('2025-06-01T10:00:00Z').getTime(); eventQueue.addjob('event123', eventStart - 10 * 60 * 1000)((err) => { if (err) console.error(err); else console.log('Job added'); }); }) .on('error', console.error);
Debug
Known issues
gotchatimed-queue uses thunk-redis which is callback-based; addjob and ackjob return thunks (functions expecting a callback), not Promises. Using .then() will cause a runtime error.
fix
Call the returned thunk with a callback: addjob(...)(callback) or wrap with a Promise manually.
affects: *
breakingNode.js version requirement is >=6, which is end-of-life. The package may not work on Node.js 18+ as thunk-redis uses deprecated APIs.
fix
Consider using Bull or BullMQ which support modern Node.js versions.
affects: >=1.0.0
deprecatedThe package has not been updated since 2019. It is effectively in maintenance mode with no new features or bug fixes.
fix
Evaluate alternatives like Bull (v3.x) or BullMQ (requires Redis Stack) for active development and support.
affects: *
gotchaDefault options (interval: 60000, retry: 30000, expire: 300000) may be too slow for high-frequency jobs. Jobs are only polled every 60 seconds by default.
fix
Set appropriate interval (e.g., 1000) for near-real-time needs, but beware of load on Redis.
affects: *
gotchaThe queue method returns a Queue instance, not a string. Calling timedQueue.queue('name') repeatedly for the same name returns the same instance.
fix
Cache the queue reference if needed, but no error if you call it multiple times.
affects: *
Errors
Common errors & fixes
TypeError: timedQueue.queue(...).addjob is not a function
Calling addjob on a non-existent object (e.g., storing result of queue() incorrectly) or using wrong method name.
fix
Ensure you use const q = timedQueue.queue('name'); then q.addjob(...)(callback).
Error: Redis connection refused
Redis server not running or wrong host/port.
fix
Start Redis or pass correct connection args: new TimedQueue({...}).connect(6379, 'localhost').
TypeError: callback is not a function
Calling addjob without providing a callback or using .then() on the thunk.
fix
Call addjob like addjob(id, timing)(function(err, res) { ... }) or wrap with a Promise function.
Upgrade
Version history
1.4.0latest on npm
Audit
Dependencies
thunk-redisrequiredRedis client dependency for connection and operations
Agent activity
45 hits · last 30 days
node
38
OpenAI (training)
1
Resources