fix(api): prefetch sub-job IDs must not contain ':'
Some checks failed
QA Gate (P0/P1) / Test affected app (pull_request) Has been cancelled

BullMQ 5.68 rejects custom job IDs containing ':' (its key separator) with
"Custom Id cannot contain :". prefetch-init's addJob built sub-job IDs as
prefetch:<vehicleId>:<categoryId>:<action>, so every attempt to queue a
children/parts job threw and the whole init failed. This was latent in the
reactive path (failures just logged) and surfaced once the hourly backfill
started driving inits at volume. Use '-' as the separator; the IDs only need
to be deterministic for dedup, not parseable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-27 15:18:04 +03:00
parent 5f0bdb467d
commit acd5691f6b

View File

@@ -478,7 +478,10 @@ export class PrefetchWorkerService implements OnModuleInit, OnModuleDestroy {
private async addJob(name: string, data: PrefetchCategoryJobData): Promise<void> { private async addJob(name: string, data: PrefetchCategoryJobData): Promise<void> {
const opts: Record<string, unknown> = { const opts: Record<string, unknown> = {
jobId: `prefetch:${data.vehicleId}:${data.categoryId}:${data.action}`, // BullMQ rejects custom job IDs containing ":" (its key separator), so use
// "-" instead. The values are UUIDs — the ID only needs to be deterministic
// (for dedup), not parseable.
jobId: `prefetch-${data.vehicleId}-${data.categoryId}-${data.action}`,
}; };
if (data.source === "parts-catalogs") { if (data.source === "parts-catalogs") {