Skip to content

fix: support Redis Cluster for BullMQ jobs#7960

Merged
Dhruwang merged 2 commits into
epic/v5from
fix/investigate-bullmq-issue
May 8, 2026
Merged

fix: support Redis Cluster for BullMQ jobs#7960
Dhruwang merged 2 commits into
epic/v5from
fix/investigate-bullmq-issue

Conversation

@xernobyl
Copy link
Copy Markdown
Contributor

@xernobyl xernobyl commented May 8, 2026

What does this PR do?

Fixes the BullMQ response pipeline enqueue failure on Redis Cluster.

Staging Redis runs as a Redis Cluster, and BullMQ uses Lua scripts that touch multiple queue keys in one operation. With the old prefix (formbricks:jobs), BullMQ keys could land in different Redis hash slots, causing CROSSSLOT Keys in request don't hash to the same slot when enqueueResponsePipelineJob tried to add a job.

This PR updates the shared BullMQ jobs prefix to {formbricks:jobs} so Redis Cluster hashes all queue keys to the same slot. It also adds a regression test and documents the prefix requirement in the background job handbook.

Fixes #(issue)

How should this be tested?

  • Run pnpm --filter @formbricks/jobs test
  • Run pnpm --filter @formbricks/logger build
  • Run pnpm --filter @formbricks/jobs build
  • Optional staging verification: submit a survey response with Redis Cluster enabled and confirm the response pipeline job enqueues without a CROSSSLOT error.

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read How we Code at Formbricks
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand bits
  • Ran pnpm build
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues
  • First PR at Formbricks? Please sign the CLA! Without it we wont be able to merge it 🙏

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Formbricks Docs if changes were necessary

xernobyl added 2 commits May 8, 2026 09:19
…to fix/investigate-bullmq-issue

# Conflicts:
#	docs/development/technical-handbook/background-job-processing.mdx
@xernobyl xernobyl marked this pull request as ready for review May 8, 2026 09:41
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 41f3344b-4eaf-4f1f-880a-78cce0a9b993

📥 Commits

Reviewing files that changed from the base of the PR and between 550bfc6 and d845894.

📒 Files selected for processing (2)
  • packages/jobs/src/constants.ts
  • packages/jobs/src/queue.test.ts

Walkthrough

This PR updates the BullMQ jobs queue Redis key prefix from a plain string "formbricks:jobs" to a hash-tagged format "{formbricks:jobs}". Hash-tagging is a Redis Cluster pattern that ensures related keys hash to the same slot for cluster-safe operations. The change modifies the exported JOBS_PREFIX constant and adds a corresponding test assertion to verify the new prefix value.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding Redis Cluster support to BullMQ jobs through a prefix update.
Description check ✅ Passed The description includes all required template sections: a detailed explanation of what the PR does, specific testing instructions, and a completed checklist with most required items checked.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 8, 2026

@Dhruwang Dhruwang merged commit 72f4e93 into epic/v5 May 8, 2026
12 checks passed
@Dhruwang Dhruwang deleted the fix/investigate-bullmq-issue branch May 8, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants