bullmq
Skill1 starsChanged 2 months agoMITView on GitHub
Build and review BullMQ (Redis-backed) job queues in Node/NestJS — queue and worker setup, concurrency, attempts and backoff, removeOnComplete/Fail, delayed and repeatable jobs, rate limiting, flows, graceful shutdown, idempotent job IDs, and the fact that Redis is the source of truth. Use when adding a background job, reviewing a BullMQ processor, or when jobs stall / duplicate / pile up in Redis.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- zhe-qi/clhoria-templatetheir own version, first seen Oct 8, 2026
- emirce/skillstheir own version, first seen May 26, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- zhe-qi/clhoria-template★ 193same name
- emirce/skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository73 other files it gives its agents.
- AGENTS.mdAGENTS.md
- bigquery-analyticsSkill
- cache-invalidationSkill
- mongo-aggregationSkill
- mongo-modelingSkill
- postgres-aggregationSkill
- postgres-indexingSkill
- redis-coordinationSkill
- redis-patternsSkill
- review-querySkill
- code-migrationSkill
- cut-releaseSkill
- data-migrationSkill
- deploy-serviceSkill
- hotfixSkill
- rollbackSkill
- design-endpointSkill
- design-eventSkill
- design-schemaSkill
- evolve-contractSkill
- scaffold-nestjs-moduleSkill
- scaffold-projectSkill
- incident-responseSkill
- investigate-bugSkill
- on-callSkill
- postmortemSkill
- audit-skillsSkill
- distill-review-styleSkill
- write-skillSkill
- debug-with-tracesSkill
- define-alertsSkill
- instrument-serviceSkill
- evaluate-dependencySkill
- grillSkill
- handoffSkill
- orientSkill
- phased-deliverySkill
- spikeSkill
- to-questionnaireSkill
- write-adrSkill
- write-prdSkill
- devops-pr-reviewSkill
- go-backend-pr-reviewSkill
- nestjs-backend-pr-reviewSkill
- python-backend-pr-reviewSkill
- react-frontend-pr-reviewSkill
- bisectSkill
- break-couplingSkill
- dead-code-sweepSkill
- deslopifySkill
- extract-moduleSkill
- rebase-cleanSkill
- resolve-merge-conflictsSkill
- split-commitSkill
- tddSkill
- wait-whatSkill
- wide-renameSkill
- kafkaSkill
- sqs-consumerSkill
- audit-dependenciesSkill
- The first 60 shown.
The file
Files
BullMQ
Redis-backed job queue. Queue (producer) + Worker (consumer) + QueueEvents
(observability), all pointed at the same Redis. NestJS: @nestjs/bullmq.
Setup
- Share one Redis connection config; BullMQ needs
maxRetriesPerRequest: nullandenableReadyCheck: falseon the ioredis connection for workers. - Redis is the source of truth for job state — the
data/redis-patternsrules apply: reconnect infinite with backoff, and Redis down means jobs don't run (degrade / alert, don't crash the app). - Redis
maxmemory+allkeys-lruis dangerous for a job queue — LRU can evict job data. Give the queue its own Redis / DB ornoevictionpolicy for the queue instance.
Job options
attempts+backoff({ type: 'exponential', delay: 1000 }) — retry transient failures. A thrown error retries; return normally = success.- Classify failures: throw to retry (transient), or catch + mark handled +
return (terminal — don't let it burn all attempts). After
attempts, the job isfailed— that's your DLQ; monitor the failed set and have a retry path. removeOnComplete/removeOnFail— set a number or age. Default keeps every job forever → Redis grows unbounded. Keep recent N for debugging, drop the rest.jobId— pass a deterministic id (a business key) to dedup: adding a job with an existing id is a no-op. This is how you get idempotent enqueue.delayfor delayed jobs; repeatable jobs (cron / every) for schedules — note repeatable jobs need a stablejobId/key or you get duplicates on redeploy.
Worker
concurrency— how many jobs one worker runs in parallel. Also run multiple worker processes for horizontal scale.- Rate limiting —
limiter: { max, duration }to cap throughput (e.g. an external API's limit). - Stalled jobs — if a worker dies mid-job, BullMQ re-queues it after
stalledInterval(up tomaxStalledCount). So handlers must be idempotent. - Graceful shutdown —
await worker.close()onSIGTERMto finish in-flight jobs and stop pulling new ones. Without it,SIGKILLmid-job → stalled → rerun.
Flows & priorities
FlowProducerfor parent/child job dependencies (fan-out then aggregate).priority(lower = higher) for queue-jumping; don't overuse — priorities make throughput reasoning harder.
Observe
QueueEventsforcompleted/failed/stalled/progress.- Track queue depth (
getWaitingCount,getDelayedCount,getFailedCount) and alert on a growing backlog or failed set.
Anti-patterns
- ❌ Queue Redis with
allkeys-lru(jobs get evicted). - ❌ No
removeOnComplete— Redis fills with finished jobs. - ❌ Non-idempotent handler (stalled jobs rerun).
- ❌ Burning all
attemptson a terminal error instead of catching it. - ❌ No graceful shutdown → stalled jobs on every deploy.
- ❌ Repeatable jobs without a stable key → duplicates after redeploy.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

