Class: BigBrother::Ticker
- Inherits:
-
Object
- Object
- BigBrother::Ticker
- Defined in:
- lib/big_brother/ticker.rb
Class Method Summary collapse
Class Method Details
.pause(&block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/big_brother/ticker.rb', line 4 def self.pause(&block) EM.cancel_timer(@timer) while @outstanding_ticks > 0 EM::Synchrony.sleep(0.1) end block.call schedule! end |
.schedule! ⇒ Object
15 16 17 18 |
# File 'lib/big_brother/ticker.rb', line 15 def self.schedule! @outstanding_ticks = 0 @timer = EM::Synchrony.add_periodic_timer(0.1, &method(:tick)) end |
.tick ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/big_brother/ticker.rb', line 20 def self.tick @outstanding_ticks += 1 BigBrother.clusters.ready_for_check.each do |cluster| BigBrother.logger.debug("Monitoring cluster #{cluster.name}") cluster.monitor_nodes end @outstanding_ticks -= 1 end |