Class: Broadcaster::Watchdog
- Inherits:
-
Object
- Object
- Broadcaster::Watchdog
- Defined in:
- lib/broadcaster/watchdog.rb
Constant Summary collapse
- CHANNEL =
'__watchdog__'.freeze
Instance Method Summary collapse
-
#initialize(broadcaster, interval:, timeout:, logger:) ⇒ Watchdog
constructor
A new instance of Watchdog.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(broadcaster, interval:, timeout:, logger:) ⇒ Watchdog
Returns a new instance of Watchdog.
6 7 8 9 10 11 |
# File 'lib/broadcaster/watchdog.rb', line 6 def initialize(broadcaster, interval:, timeout:, logger:) @broadcaster = broadcaster @interval = interval @timeout = timeout @logger = logger end |
Instance Method Details
#start ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/broadcaster/watchdog.rb', line 13 def start @thread = Thread.new do loop do sleep interval check end end end |
#stop ⇒ Object
22 23 24 |
# File 'lib/broadcaster/watchdog.rb', line 22 def stop thread.kill end |