BUG: BullMQ orphan jobs remain when asset row is deleted — no GC for dangling jobs #73

Closed
opened 2026-05-25 06:19:04 -04:00 by zgaetano · 1 comment
Owner

Already fixed. DELETE /api/v1/assets/:id?hard=true removes any pending/delayed/prioritised BullMQ jobs that reference the asset before dropping the row (services/mam-api/src/routes/assets.js:494-505). Soft-delete (status=archived) is the default and leaves jobs alone, which is the intended behaviour.

Already fixed. `DELETE /api/v1/assets/:id?hard=true` removes any pending/delayed/prioritised BullMQ jobs that reference the asset before dropping the row (`services/mam-api/src/routes/assets.js:494-505`). Soft-delete (`status=archived`) is the default and leaves jobs alone, which is the intended behaviour.
Author
Owner

Fix Plan — #73 BullMQ orphan jobs on asset delete

Root cause: DELETE /:id?hard=true deletes S3 objects and asset row but never removes associated BullMQ jobs from proxy and thumbnail queues. Workers receive jobs, try to fetch missing asset, produce silent failures.

Fix — remove BullMQ jobs before deleting asset:

// In assets.js DELETE handler, before DELETE FROM assets:
const proxyJobs = await proxyQueue.getJobs(['waiting', 'delayed']);
const thumbJobs = await thumbnailQueue.getJobs(['waiting', 'delayed']);

for (const job of [...proxyJobs, ...thumbJobs]) {
  if (job.data.assetId === assetId) await job.remove();
}

Files: src/routes/assets.js DELETE handler
Effort: ~1h
**Priority: P2 — orphaned jobs

## Fix Plan — #73 BullMQ orphan jobs on asset delete **Root cause:** DELETE /:id?hard=true deletes S3 objects and asset row but never removes associated BullMQ jobs from proxy and thumbnail queues. Workers receive jobs, try to fetch missing asset, produce silent failures. **Fix — remove BullMQ jobs before deleting asset:** ```js // In assets.js DELETE handler, before DELETE FROM assets: const proxyJobs = await proxyQueue.getJobs(['waiting', 'delayed']); const thumbJobs = await thumbnailQueue.getJobs(['waiting', 'delayed']); for (const job of [...proxyJobs, ...thumbJobs]) { if (job.data.assetId === assetId) await job.remove(); } ``` **Files:** src/routes/assets.js DELETE handler **Effort:** ~1h **Priority: P2 — orphaned jobs
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: WildDragonLLC/dragonflight#73
No description provided.