fix(jobs): cancel running + delete failed jobs so the queue can be unstuck #28

Merged
zgaetano merged 1 commit from fix/jobs-cancel-stuck into main 2026-05-23 16:54:50 -04:00
Owner

Summary

The Jobs page only exposed a delete button for queued and done jobs. A stalled-active job (worker died holding a BullMQ concurrency slot) had no kill switch in the UI, so a single stuck thumbnail job could back the entire queue up behind it.

  • Running jobs now show a Cancel button (red text). Confirm copy spells out that the worker may run a few seconds longer in the background but the queue slot frees up immediately.
  • Failed jobs now show the X-icon Delete in addition to the existing Retry button.
  • Both routes hit the same DELETE /jobs/:id endpoint; BullMQ's job.remove() works on any state including stalled-active.
Status Actions
queued × Delete
running × Cancel (new)
done × Delete
failed ↻ Retry, × Delete (new)

handleDelete takes an optional mode ('cancel' / 'delete') only to customise the confirm prompt and error toast wording. Action cell is right-aligned for consistency with other tables.

Test plan

  • Find the stuck running thumbnail job, click Cancel — confirm dialog explains slot frees up
  • After Cancel, queued jobs behind it start processing within a few seconds
  • Failed jobs show both Retry and Delete; Delete asks before removing
  • Queued / done jobs still show just the X-icon Delete
  • Re-fetch (5s auto or manual Refresh) confirms the job is gone from BullMQ

🤖 Generated with Claude Code

## Summary The Jobs page only exposed a delete button for `queued` and `done` jobs. A stalled-active job (worker died holding a BullMQ concurrency slot) had no kill switch in the UI, so a single stuck thumbnail job could back the entire queue up behind it. - **Running jobs** now show a **Cancel** button (red text). Confirm copy spells out that the worker may run a few seconds longer in the background but the queue slot frees up immediately. - **Failed jobs** now show the X-icon **Delete** in addition to the existing Retry button. - Both routes hit the same `DELETE /jobs/:id` endpoint; BullMQ's `job.remove()` works on any state including stalled-active. | Status | Actions | |---|---| | queued | × Delete | | running | × Cancel (new) | | done | × Delete | | failed | ↻ Retry, × Delete (new) | `handleDelete` takes an optional `mode` (`'cancel'` / `'delete'`) only to customise the confirm prompt and error toast wording. Action cell is right-aligned for consistency with other tables. ## Test plan - [ ] Find the stuck running thumbnail job, click Cancel — confirm dialog explains slot frees up - [ ] After Cancel, queued jobs behind it start processing within a few seconds - [ ] Failed jobs show both Retry and Delete; Delete asks before removing - [ ] Queued / done jobs still show just the X-icon Delete - [ ] Re-fetch (5s auto or manual Refresh) confirms the job is gone from BullMQ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
zgaetano added 1 commit 2026-05-23 16:54:33 -04:00
The Jobs page only exposed a delete button for queued + done jobs, so a
stalled-active job (worker died holding a BullMQ concurrency slot) had
no way out from the UI. Operators were watching the queue back up
behind a single stuck thumbnail job with no kill switch.

- Running jobs now show a "Cancel" button (red text). Confirm copy
  spells out that the worker may run a few seconds longer in the
  background but the queue slot frees up immediately.
- Failed jobs now show the X icon for delete in addition to the
  existing Retry button.
- Both routes hit the same DELETE /jobs/:id endpoint; BullMQ's
  job.remove() works on any state including stalled-active.
- handleDelete takes an optional mode ('cancel' | 'delete') only to
  customise the confirm prompt and error toast wording.

Right-aligned the action cell so the Retry/Cancel/Delete buttons sit
flush right like the rest of the table's actions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
zgaetano merged commit 2b85fb49df into main 2026-05-23 16:54:50 -04:00
zgaetano deleted branch fix/jobs-cancel-stuck 2026-05-23 16:54:51 -04:00
Sign in to join this conversation.
No reviewers
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#28
No description provided.