Worker patterns
Five things worth knowing about BullMQ workers — how long a job can run, how heavy it can be, and how to split or retry parts of it. Each button enqueues real jobs that the worker container picks up. Every run also shows up in Workbench.
Long-running jobs
How long can a job run?No limit — the constraint is the lock. The worker renews it every lockDuration/2 (15s by default) while the job runs. Watch progress and per-job logs stream in, then hit Cancel to fire the processor's AbortSignal mid-flight.
examples/1-long-running.ts
Jobs
pattern-long-runningNothing here yet — use a button above.
Steps & checkpoints
Can I retry only part of a job?A retry re-runs your processor from the top — which double-charges the card unless you checkpoint. job.updateData() persists to Redis immediately and survives the failure, so attempt 2 skips what attempt 1 finished.
examples/2-steps-and-checkpoints.ts
Jobs
pattern-checkpointsNothing here yet — use a button above.
Flows (parent / child)
Can I split it into separate jobs?Each part becomes a real job with its own id, attempts and retries. The parent stays waiting-children until every child completes, and one failed child retries alone while its siblings stay done.
examples/3-flows.ts
Jobs
pattern-flowNothing here yet — use a button above.
Concurrency & rate limits
How do I control throughput?concurrency is per worker process; limiter is global across every worker, enforced through Redis. This worker runs concurrency 4 with a limiter of 2/second — the start times below show which one wins.
examples/4-throughput.ts
Jobs
pattern-throughputNothing here yet — use a button above.
CPU-heavy work
How heavy can a job be?Blocking the event loop stops lock renewal, so BullMQ decides the job is dead and another worker may pick it up while yours is still computing. Same 6-second burn, run both ways — in-process stalls, sandboxed (forked into its own process) completes.
examples/5-cpu-heavy.ts
in-process (blocking)
pattern-cpu-blockingNothing here yet — use a button above.
sandboxed (forked)
pattern-cpu-sandboxedNothing here yet — use a button above.