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
sass-3.1.0.alpha.200 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.1.0.alpha.51 vendor/fssm/lib/fssm/backends/polling.rb
haml-3.1.0.alpha.37 vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
compass-0.11.alpha.3 lib/vendor/fssm/fssm/backends/polling.rb
sass-3.1.0.alpha.50 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.1.0.alpha.49 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.1.0.alpha.48 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.1.0.alpha.47 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.1.0.alpha.46 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.1.0.alpha.45 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.1.0.alpha.44 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.1.0.alpha.43 vendor/fssm/lib/fssm/backends/polling.rb
haml-3.1.0.alpha.36 vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
sass-3.1.0.alpha.42 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.1.0.alpha.41 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.1.0.alpha.40 vendor/fssm/lib/fssm/backends/polling.rb
compass-0.11.alpha.1 lib/vendor/fssm/fssm/backends/polling.rb
sass-3.1.0.alpha.39 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.1.0.alpha.38 vendor/fssm/lib/fssm/backends/polling.rb
sass-3.1.0.alpha.37 vendor/fssm/lib/fssm/backends/polling.rb