Class: Nodectl::Watchdog

Inherits:
Object
  • Object
show all
Defined in:
lib/nodectl/watchdog.rb

Constant Summary collapse

TICK_INTERVAL =
2

Instance Method Summary collapse

Constructor Details

#initializeWatchdog

Returns a new instance of Watchdog.



4
5
6
# File 'lib/nodectl/watchdog.rb', line 4

def initialize
  @timer = EM.add_periodic_timer(TICK_INTERVAL, method(:tick))
end

Instance Method Details

#tickObject



8
9
10
11
12
13
14
15
16
# File 'lib/nodectl/watchdog.rb', line 8

def tick
  Nodectl::Instance.all.each do |instance|
    instance.alive?
  end

  Nodectl::Process.all.each do |process|
    process.alive?
  end
end