Class: CompletionKit::WorkerHealth
- Inherits:
-
Object
- Object
- CompletionKit::WorkerHealth
- Defined in:
- app/services/completion_kit/worker_health.rb
Constant Summary collapse
- HEARTBEAT_THRESHOLD =
SolidQueue workers heartbeat every SolidQueue.process_heartbeat_interval (60s by default), so a 30s window flagged healthy workers as down between beats. Allow two missed heartbeats before we say the worker is gone.
2.minutes
Class Method Summary collapse
Class Method Details
.healthy? ⇒ Boolean
8 9 10 11 12 13 14 |
# File 'app/services/completion_kit/worker_health.rb', line 8 def self.healthy? return true unless defined?(::SolidQueue::Process) ::SolidQueue::Process .where("kind LIKE 'Worker%'") .where("last_heartbeat_at > ?", HEARTBEAT_THRESHOLD.ago) .exists? end |