https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43145

--- Comment #2 from David Nind <[email protected]> ---
Created attachment 202271
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=202271&action=edit
Bug 43145: Add Koha::Health::BackgroundJobs health check

Health check for the background job processing system.

Detects queues where workers appear to be down by checking for
pending jobs with no recent worker activity (started/finished) in
the last minute. Workers poll every 10 seconds, so 1 minute without
activity on a queue with pending jobs is a strong signal.

Checks per-queue:
- queue_no_worker: queue has pending jobs but no job started or
  finished recently => critical (worker likely dead)
- jobs_failed: any failed jobs accumulating => warning

This correctly handles:
- long_tasks with a 2-hour job running: started_on is recent => healthy
- default with pending jobs and no activity in 1+ min => stuck
- es_indexing with backlog but recent completions => healthy (just busy)

Permission: { parameters => 'manage_background_jobs' }

Registered in Koha::Health->core_checks.
Translation strings added to about.tt.

Test plan:
1. Apply patch
2. Run:
   $ ktd --name bug_43137 --shell
  k$ prove -v t/db_dependent/Koha/Health/BackgroundJobs.t
   => SUCCESS: All tests pass
3. Tests cover:
   - Correct permission declaration
   - Healthy state (no pending jobs)
   - Pending jobs with recent activity (healthy)
   - Queue with no worker activity (critical)
   - Multiple queues, only stuck one reported
   - Failed jobs detection (warning)
4. Sign off :-D

Assisted-by: Sonnet 4 (Anthropic)
Signed-off-by: David Nind <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to