BUG: Batch-trim DB jobs row is orphaned — no status lifecycle, job_type enum is stale #90

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

Fixed via migration 016 — jobs.expires_at TTL ensures batch-trim rows don't sit orphaned, and the trim worker writes completed/failed status correctly now that job_status has the completed enum value. See #75, #70.

Fixed via migration 016 — `jobs.expires_at` TTL ensures batch-trim rows don't sit orphaned, and the trim worker writes `completed`/`failed` status correctly now that `job_status` has the `completed` enum value. See #75, #70.
zgaetano changed title from BUG: Trim jobs invisible in Jobs screen — inserted into DB jobs table but screen reads BullMQ only to BUG: Batch-trim DB jobs row is orphaned — no status lifecycle, job_type enum is stale 2026-05-25 19:29:26 -04:00
Author
Owner

Fix Plan — #90 Batch-trim DB jobs row orphaned

Root cause: assets.js:batch-trim INSERTs a row into jobs DB table with type "trim" status "queued", but jobs.js GET route reads exclusively from BullMQ queues — never from jobs DB table. The DB row is invisible and permanent.

Fix (choose one):

Option A: Make jobs.js also query the jobs DB table, UNION with BullMQ state. Show combined status.

Option B (simpler): Stop writing to jobs DB table in batch-trim. Track status purely via BullMQ job state + temp_segments table. Remove the dead INSERT.

Also fix: temp_segments.job_id FK → ON DELETE CASCADE needs the actual BullMQ job ID or the DB jobs.id to match what gets inserted.

Files: src/routes/assets.js (batch-trim handler), src/routes/jobs.js
Effort: ~1.5h
**Priority: P2 — data consistency

## Fix Plan — #90 Batch-trim DB jobs row orphaned **Root cause:** `assets.js:batch-trim` INSERTs a row into `jobs` DB table with type `"trim"` status `"queued"`, but `jobs.js` GET route reads exclusively from BullMQ queues — never from `jobs` DB table. The DB row is invisible and permanent. **Fix (choose one):** **Option A:** Make `jobs.js` also query the `jobs` DB table, UNION with BullMQ state. Show combined status. **Option B (simpler):** Stop writing to `jobs` DB table in `batch-trim`. Track status purely via BullMQ job state + `temp_segments` table. Remove the dead INSERT. **Also fix:** `temp_segments.job_id` FK → `ON DELETE CASCADE` needs the actual BullMQ job ID or the DB `jobs.id` to match what gets inserted. **Files:** `src/routes/assets.js` (batch-trim handler), `src/routes/jobs.js` **Effort:** ~1.5h **Priority: P2 — data consistency
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#90
No description provided.