tekir
All Packages
Communicationv0.1.5

@tekir/queue

Background job queues with memory, Redis, and SQLite backends.

Installation

$bun add @tekir/queue

Features

  • BaseJob class with handle() method
  • Memory, Redis, and Database backends
  • Job dispatch with delay, retries, and queue name
  • Worker with event-based processing
  • Bulk dispatch and queue purge
  • Job registry for deserialization

Quick Example

TypeScript
import { Queue, BaseJob } from '@tekir/queue'

class SendEmail extends BaseJob {
  async handle() { /* send email */ }
}

const queue = new Queue()
queue.register(SendEmail)
await queue.dispatch(new SendEmail())
queue.worker().start()

Changelog

v0.1.5LatestSeptember 16, 2026
  • Worker shutdown is idempotent under concurrent calls, and database/Redis backends retain consistent job state through claims, retries, and cleanup.
  • Published output now uses the shared Node-targeted ESM bundle pipeline with external dependencies and generated TypeScript declarations, while Bun consumers keep the native source export.
v0.1.4July 23, 2026
  • Package metadata now follows the shared compatible 0.1.x dependency range used by this coordinated Tekir release.
v0.1.3July 16, 2026
  • Redis jobs use atomic claim and lease recovery, worker polling survives backend errors, repeated stop calls settle safely, and memory/database backends retain completed records consistently.
v0.1.2June 13, 2026
  • Job claiming is now atomic on the database and Redis backends, so two workers can never pick up the same job. The database backend uses a conditional claim with a unique token; the Redis backend uses a single Lua script, which also means a crash mid-claim no longer strands a job.
  • Both backends gained a visibility timeout (60 s). A job whose worker died mid-processing is recovered back to pending instead of being lost, and retries now persist the attempt count on the existing row instead of re-pushing (no primary-key collisions).
  • Poison jobs no longer retry forever. A new NonRetryableError is thrown for invalid JSON or an unregistered job class and fails the job immediately without consuming the retry budget.
  • concurrency(n) and pollInterval(ms) now reject non-positive, NaN, and negative values.
  • Found and fixed with Fable.
v0.1.1April 29, 2026
  • Memory and database queue setups now type-check cleanly without @tekir/redis installed. The redis backend is loaded only when the redis driver is used.
v0.1.0April 1, 2026
  • Initial release

Other Communication packages