Class: EventHub::ActorWatchdog

Inherits:
Object
  • Object
show all
Includes:
Celluloid, Helper
Defined in:
lib/eventhub/actor_watchdog.rb

Overview

Watchdog class

Constant Summary collapse

MISSING_QUEUE_THRESHOLD =

number of consecutive failed cycles before we raise to force a restart

3

Instance Method Summary collapse

Methods included from Helper

#bunny_connection_options, #create_bunny_connection, #get_name_from_class, #now_stamp, #stringify_keys

Constructor Details

#initializeActorWatchdog

Returns a new instance of ActorWatchdog.



13
14
15
16
17
18
# File 'lib/eventhub/actor_watchdog.rb', line 13

def initialize
  cycle = Configuration.processor[:watchdog_cycle_in_s]
  EventHub.logger.info("Watchdog is starting [cycle: #{cycle}s]...")
  @consecutive_failures = 0
  async.start
end

Instance Method Details

#cleanupObject



27
28
29
# File 'lib/eventhub/actor_watchdog.rb', line 27

def cleanup
  EventHub.logger.info("Watchdog is cleaning up...")
end

#startObject



20
21
22
23
24
25
# File 'lib/eventhub/actor_watchdog.rb', line 20

def start
  loop do
    watch
    sleep Configuration.processor[:watchdog_cycle_in_s]
  end
end