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 concurrency —
MAX_WORKERSlimits 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— BullMQQueueinstance (ornull).isQueueAvailable—truewhen the queue is usable.closeQueue— Gracefully close the queue connection.getQueueStats— Return queue depth and active job count.
Members
(static) runQueue :Object|null
BullMQ Queue instance for run jobs.
Type:
- Object | null
Methods
(static) closeQueue() → {Promise.<void>}
Gracefully close the queue connection.
Called from the shutdown hook in index.js.
Returns:
- Type
- Promise.<void>
(static) getQueueStats() → {Promise.<Object>}
Get queue statistics (waiting + active counts).
Returns:
{ waiting, active, delayed, failed }
- Type
- Promise.<Object>
(static) isQueueAvailable() → {boolean}
Check whether the BullMQ queue is available.
Returns:
- Type
- boolean