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

Version Path
haml-3.1.3 vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
haml-3.2.0.alpha.8 vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
sass-3.1.4 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.2.0.alpha.11 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.1.3 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.2.0.alpha.9 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.2.0.alpha.8 vendor/fssm/lib/fssm/backends/polling.rb
haml-3.2.0.alpha.5 vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
haml-3.2.0.alpha.4 vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
haml-3.1.2 vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
sass-3.1.2 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.2.0.alpha.7 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.2.0.alpha.6 vendor/fssm/lib/fssm/backends/polling.rb
radiant-1.0.0.rc1 vendor/plugins/haml/vendor/fssm/lib/fssm/backends/polling.rb
haml-3.2.0.alpha.3 vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
sass-3.2.0.alpha.4 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.2.0.alpha.3 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.1.1 vendor/fssm/lib/fssm/backends/polling.rb
haml-3.2.0.alpha.2 vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
haml-3.1.1 vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb