Sha256: 978ac06d7677dedbc119265c283c1ac8f0491ad90c967e0dcbb59d7810287bdd
Contents?: true
Size: 597 Bytes
Versions: 18
Compression:
Stored size: 597 Bytes
Contents
module FSSM::Backends class Polling def initialize(options={}) @handlers = [] @latency = options[:latency] || 1 end def add_path(path, preload=true) handler = FSSM::State.new(path) handler.refresh(path.to_pathname, 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
18 entries across 18 versions & 5 rubygems