Registry / devops / timer-queue

timer-queue

JSON →
library1.1.0jsnpmunverified

A lightweight, configurable job queue for Node.js and browsers that schedules function execution with configurable interval, timeout, retry, and retry interval. v1.1.0 (stable, no recent updates). Provides three patterns for async control: synchronous boolean returns, callback-based (done/error), and Promise-based. Events for 'end' and 'error'. Differentiator: simple timer-based queue without external dependencies, supporting per-job retry and delay.

npm install timer-queue
INSTALL
IMPORT
SIG · TIMER-QUEUE
T
timer-queue
devopsjavascriptv1.1.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.

TimerQueue
import TimerQueue from 'timer-queue'
const TimerQueue = require('timer-queue')
ESM-only; use default import.
TimerQueue as default
import TimerQueue from 'timer-queue'
import { TimerQueue } from 'timer-queue'
Must use default import, not named import.

Creates a timer queue with 1s interval, 5s timeout, 2 retries. Pushes three jobs using boolean return, callback, and Promise patterns. Starts automatically.

import TimerQueue from 'timer-queue'; const tq = new TimerQueue({ interval: 1000, timeout: 5000, retry: 2, retryInterval: 200, autostart: true }); tq.push(() => { console.log('Job executed'); return true; }); tq.push((done, error) => { setTimeout(() => done(), 100); }); tq.push(() => new Promise(resolve => setTimeout(resolve, 100))); tq.on('end', () => console.log('Queue finished')); tq.on('error', err => console.error('Queue error:', err));
Debug
Known issues
breakingNo TypeScript type definitions included
fix
Create your own .d.ts or use @types/timer-queue if available.
affects: >=1.0.0
gotchaJob function must return a boolean (true = success) or a Promise, or call done(error) callback. Incorrect return type may cause endless retries.
fix
Ensure job returns Boolean (true/false) or a Promise, or uses callback pattern correctly.
affects: >=1.0.0
gotchaIf autostart is false and start() is not called, queue never executes. Common mistake: push jobs but forget to start.
fix
Either set autostart: true or call tq.start() after pushing jobs.
affects: >=1.0.0
deprecatedNo deprecations known; package stable with no updates since 2018.
fix
Consider using more actively maintained queue libraries like p-queue or bull for advanced needs.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: TimerQueue is not a constructor
Using named import instead of default import
fix
import TimerQueue from 'timer-queue'
Unhandled promise rejection: ReferenceError: done is not defined
Using callback pattern without passing arguments to push()
fix
Use push((done, error) => { ... }) not push(function(done, error) { ... }) with wrong signature.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
timer-queue — npm install timer-queue · libregistry