Class: QueuePulse::Checks::StuckJobs
- Defined in:
- lib/queue_pulse/checks/stuck_jobs.rb
Overview
Alerts on jobs that have been claimed (running) longer than stuck_job_threshold. Cooldown is per job_id so each stuck job alerts once per window. (Requirements US-4.)
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from QueuePulse::Checks::Base
Instance Method Details
#call ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/queue_pulse/checks/stuck_jobs.rb', line 9 def call threshold = config.stuck_job_threshold now = source.now source.stuck_claimed_executions(older_than: threshold).filter_map do |claimed| running = (now - claimed.claimed_at).to_i with_cooldown("stuck_job:#{claimed.job_id}") do stuck_alert(claimed, running) end end end |