Sha256: 0d6132678274de568375fa7c0408e2359f35168d07e1191f31b5a87f95bdeb7f

Contents?: true

Size: 552 Bytes

Versions: 266

Compression:

Stored size: 552 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

266 entries across 119 versions & 8 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/haml-3.1.4/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.7.5 vendor/bundle/gems/haml-3.1.5/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.7.5 vendor/bundle/gems/haml-3.1.6/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.7.5 vendor/bundle/gems/sass-3.1.15/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.7.4 vendor/bundle/gems/sass-3.1.15/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.7.4 vendor/bundle/gems/haml-3.1.4/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.7.4 vendor/bundle/gems/haml-3.1.5/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.7.4 vendor/bundle/gems/haml-3.1.6/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.7.3 vendor/bundle/gems/sass-3.1.15/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.7.3 vendor/bundle/gems/haml-3.1.4/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.7.3 vendor/bundle/gems/haml-3.1.5/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.7.3 vendor/bundle/gems/haml-3.1.6/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
sadui-0.0.4 vendor/bundle/ruby/2.1.0/gems/fssm-0.2.10/lib/fssm/backends/polling.rb
sadui-0.0.4 vendor/bundle/ruby/2.0.0/gems/fssm-0.2.10/lib/fssm/backends/polling.rb
torquebox-console-0.3.0 vendor/bundle/jruby/1.9/gems/haml-3.1.8/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.7.2 vendor/bundle/gems/haml-3.1.4/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.7.2 vendor/bundle/gems/haml-3.1.6/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.7.2 vendor/bundle/gems/haml-3.1.5/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.7.2 vendor/bundle/gems/sass-3.1.15/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.7.1 vendor/bundle/gems/haml-3.1.4/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb