Class: QueuePulse::Checks::WorkerLiveness

Inherits:
Base
  • Object
show all
Defined in:
lib/queue_pulse/checks/worker_liveness.rb

Overview

Alerts when no worker/dispatcher process has a fresh heartbeat — meaning nothing is processing jobs. Critical, because the queue silently stops. (Requirements US-5.) Only fires when at least one process was ever registered, to avoid false alarms before the first boot.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from QueuePulse::Checks::Base

Instance Method Details

#callObject



10
11
12
13
14
15
16
17
18
# File 'lib/queue_pulse/checks/worker_liveness.rb', line 10

def call
  return [] if source.total_process_count.to_i.zero?

  live = source.live_process_count(heartbeat_within: config.worker_heartbeat_threshold)
  return [] if live.positive?

  alert = with_cooldown("workers_down") { workers_down_alert }
  Array(alert)
end