Skip to content

Exclude aborted jobs from pending count and stats#505

Merged
dereuromark merged 2 commits into
masterfrom
fix-pending-count-exclude-aborted
May 28, 2026
Merged

Exclude aborted jobs from pending count and stats#505
dereuromark merged 2 commits into
masterfrom
fix-pending-count-exclude-aborted

Conversation

@dereuromark
Copy link
Copy Markdown
Owner

Summary

  • getPendingCount() / getPendingStats() no longer count jobs that exhausted their retries (status = aborted). Those are terminal and will never run again, so they were wrongly inflating the admin pending total and any external caller. Now consistent with isQueued() and the admin status filter.
  • Admin dashboard derivation pending = totalPending - running - failed previously double-removed aborted rows (they carry a failure_message, so the failed operand still counted them while totalPending no longer does). The derivation now subtracts only still-retriable failures, so a single real pending job alongside an aborted one no longer renders as 0 pending.
  • reset() now clears status, so resetting an aborted job for rerun returns it to the pending universe and lets a worker pick it up again.

Notes

  • No schema change; status column already exists.
  • New tests: pending count/stats exclude aborted; reset clears aborted status.
  • Worker fetch (requestJob) was already terminal-safe via attempts < retries + 1; unchanged.

getPendingCount() and getPendingStats() counted jobs that had exhausted
their retries (status = aborted) even though they are terminal and will
never run again. That inflated the admin pending total and any external
caller. They now exclude status = aborted, matching isQueued() and the
admin status filter.

Two interactions handled:
- The admin dashboard derives pending = totalPending - running - failed.
  Aborted rows carry a failure_message, so the failed operand still
  counted them; the derivation now subtracts only still-retriable
  failures to avoid double-removing aborted rows (which zeroed out real
  pending work).
- reset() now clears status so a reset job loses its terminal aborted
  state and counts as pending and gets picked up again.
@dereuromark dereuromark merged commit b27c180 into master May 28, 2026
16 checks passed
@dereuromark dereuromark deleted the fix-pending-count-exclude-aborted branch May 28, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant