Module: queue

Shared BullMQ queue for durable run execution (INF-003).

When Redis is available (REDIS_URL is set and ioredis + bullmq are installed), run execution is routed through a BullMQ queue instead of the fire-and-forget runWithAbort pattern. This provides:

  • Durability — jobs survive process crashes; stuck runs are retried.
  • Global concurrencyMAX_WORKERS limits total parallel runs.
  • Visibility — queue depth and active job count are queryable.

When Redis is NOT available, the queue is null and callers fall back to the existing runWithAbort in-process execution. This keeps SQLite-only deployments working unchanged.

Exports

  • runQueue — BullMQ Queue instance (or null).
  • isQueueAvailabletrue when the queue is usable.
  • closeQueue — Gracefully close the queue connection.
  • getQueueStats — Return queue depth and active job count.
Source:

Members

(static) runQueue :Object|null

BullMQ Queue instance for run jobs.

Type:
  • Object | null
Source:

Methods

(static) closeQueue() → {Promise.<void>}

Gracefully close the queue connection. Called from the shutdown hook in index.js.

Source:
Returns:
Type
Promise.<void>

(static) getQueueStats() → {Promise.<Object>}

Get queue statistics (waiting + active counts).

Source:
Returns:

{ waiting, active, delayed, failed }

Type
Promise.<Object>

(static) isQueueAvailable() → {boolean}

Check whether the BullMQ queue is available.

Source:
Returns:
Type
boolean