Module: JstdRunner::Monitorable

Included in:
Browser, Server
Defined in:
lib/jstd-runner/monitorable.rb

Instance Method Summary collapse

Instance Method Details

#monitor(interval, &failure_callback) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/jstd-runner/monitorable.rb', line 3

def monitor(interval, &failure_callback)
  EM.add_periodic_timer(interval) {
    next if JstdRunner.shutting_down || @restarting
    if running?
      Log.info "ok: #{self}"
    else
      Log.info "dead: #{self}"
      failure_callback.call
    end
  }
end