Sha256: b9747d521b0fa23dd27b99ad7477d4186cb7cc7962fb0e746d497b457112c273
Contents?: true
Size: 549 Bytes
Versions: 332
Compression:
Stored size: 549 Bytes
Contents
module FSSM::Backends class Polling def initialize(options={}) @handlers = [] @latency = options[:latency] || 1.5 end def add_handler(handler, preload=true) handler.refresh(nil, true) if preload @handlers << handler end def run begin loop do start = Time.now.to_f @handlers.each {|handler| handler.refresh} nap_time = @latency - (Time.now.to_f - start) sleep nap_time if nap_time > 0 end rescue Interrupt end end end end
Version data entries
332 entries across 332 versions & 7 rubygems