Sha256: 98a754f1e8b82792dbf50d45de4a2c17a69a83d2d76ea2d17bf325ce6115931f
Contents?: true
Size: 553 Bytes
Versions: 4
Compression:
Stored size: 553 Bytes
Contents
module BigBrother class Ticker def self.pause(&block) EM.cancel_timer(@timer) while @outstanding_ticks > 0 EM::Synchrony.sleep(0.1) end block.call schedule! end def self.schedule! @outstanding_ticks = 0 @timer = EM::Synchrony.add_periodic_timer(0.1, &method(:tick)) end def self.tick @outstanding_ticks += 1 BigBrother.clusters.values.select(&:needs_check?).each do |cluster| cluster.monitor_nodes end @outstanding_ticks -= 1 end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
big_brother-0.3.0 | lib/big_brother/ticker.rb |
big_brother-0.2.1 | lib/big_brother/ticker.rb |
big_brother-0.2.0 | lib/big_brother/ticker.rb |
big_brother-0.1.0 | lib/big_brother/ticker.rb |