fix: send scheduled campaigns on BullMQ 5
Closed
VL
2mo ago+36+36+01234567890123456789-8-8-0123456789
Scheduled campaigns never leave SCHEDULED on BullMQ 5. The batch queue uses a custom job ID containing a colon, which BullMQ rejects with "Custom Id cannot contain :".
This changes the separator to a hyphen and adds a regression test at the CampaignBatchService.queueBatch call site.
Verification:
- Reproduced against a deployed self-hosted instance
- Confirmed the new test fails before the fix
- Focused campaign service tests: 6 passed
- Full web unit suite: 121 passed
- Web typecheck passed
- Focused ESLint passed
- Production verification after the same fix: a scheduled campaign completed 1/1
Migration notes: none. No schema, configuration, or dependency changes.
Summary by cubic
Scheduled campaigns on bullmq 5 were stuck in SCHEDULED because the batch queue used a custom job ID with a colon, which bullmq rejects. We now use a hyphenated job ID, so campaigns enqueue and execute.
- CampaignBatchService.queueBatch sets jobId to "campaign-batch-" (was "campaign-batch:"); preserves deterministic idempotency.
- Adds a regression test that asserts a BullMQ-compatible job ID and verifies
Queue.addreceives the expected arguments; adjusts test mocks to spy on queue and contact updates. - No schema, configuration, or dependency changes; no migration actions.
Summary by CodeRabbit
- Bug Fixes
- Improved campaign batch processing by ensuring queued jobs use compatible identifiers.
- Tests
- Expanded coverage for campaign batch queuing and contact subscription updates.
- Updated test scenarios to verify queued job details and webhook-related behavior.