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.3.2 vendor/bundle/gems/haml-3.1.6/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.3.2 vendor/bundle/gems/haml-3.1.5/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.3.2 vendor/bundle/gems/haml-3.1.4/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.3.1 vendor/bundle/gems/sass-3.1.15/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.3.1 vendor/bundle/gems/haml-3.1.6/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.3.1 vendor/bundle/gems/haml-3.1.5/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.3.1 vendor/bundle/gems/haml-3.1.4/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.3.0 vendor/bundle/gems/haml-3.1.4/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.3.0 vendor/bundle/gems/sass-3.1.15/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.3.0 vendor/bundle/gems/haml-3.1.6/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.3.0 vendor/bundle/gems/haml-3.1.5/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.2.4.pre vendor/bundle/gems/sass-3.1.15/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.2.4.pre vendor/bundle/gems/haml-3.1.5/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
classiccms-0.2.4.pre vendor/bundle/gems/haml-3.1.4/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
haml-3.1.6 vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
haml-3.1.6.rc.1 vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
haml-3.1.5 vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
haml-3.1.5.rc.1 vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
haml-3.1.5.beta.1 vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb
sass-3.2.0.alpha.102 vendor/fssm/lib/fssm/backends/polling.rb