An evented event queue for Node.js, providing a cadence-based queue with event-driven control flow. Version 5.0.5 is the latest stable release. Turnstile offers a simple, lightweight queue implementation with pause/resume, concurrency control, and event hooks for start, finish, and drain. It differentiates itself from more complex job queues like Bull or Kue by focusing on simplicity and minimal dependencies, suitable for small to medium workloads.
npm install turnstileNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a queue with concurrency 2, enqueues three tasks, and processes them with event handlers.
Use ESM import syntax. If using require, stick to v4.
Use 'flush' event instead of 'process'.
Ensure concurrency is an integer; parseInt or Math.floor before creating queue.
Ensure you attach 'process' or 'flush' listener before calling start().
Use import { Queue } from 'turnstile' or require('turnstile').Queue.Ensure concurrency is a positive integer.
Call queue.start() after enqueuing tasks and attaching event listeners.