Sha256: 5919b970e338dc4b0adf4363710de5283208793d6eb8a7d90102f72971d5ecac

Contents?: true

Size: 1.38 KB

Versions: 97

Compression:

Stored size: 1.38 KB

Contents

module Listen
  module Adapters

    DEFAULT_POLLING_LATENCY = 1.0

    # Polling Adapter that works cross-platform and
    # has no dependencies. This is the adapter that
    # uses the most CPU processing power and has higher
    # file IO than the other implementations.
    #
    class Polling < Adapter
      private

      # The default delay between checking for changes.
      #
      # @see Listen::Adapter#default_latency
      #
      def default_latency
        1.0
      end

      # The thread on which the main thread should wait
      # when the adapter has been started in blocking mode.
      #
      # @see Listen::Adapter#blocking_thread
      #
      def blocking_thread
        poller_thread
      end

      # @see Listen::Adapter#start_worker
      #
      # @see Listen::Adapter#start_worker
      #
      def start_worker
        # The polling adapter has no worker! Sad panda! :'(
      end

      # Poll listener directory for file system changes.
      #
      # @see Listen::Adapter#poll_changed_directories
      #
      def poll_changed_directories
        until stopped
          next if paused

          start = Time.now.to_f
          callback.call(directories.dup, :recursive => true)
          turnstile.signal
          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

97 entries across 94 versions & 8 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/polling.rb
brakeman-4.4.0 bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/polling.rb
brakeman-4.3.1 bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/polling.rb
brakeman-4.3.0 bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/polling.rb
brakeman-4.2.1 bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/polling.rb
brakeman-4.2.0 bundle/ruby/2.3.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/polling.rb
brakeman-4.1.1 bundle/ruby/2.3.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/polling.rb
brakeman-4.1.0 bundle/ruby/2.3.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/polling.rb
brakeman-4.0.1 bundle/ruby/2.3.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/polling.rb
brakeman-4.0.1.pre1 bundle/ruby/2.3.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/polling.rb
brakeman-4.0.0 bundle/ruby/2.3.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/polling.rb
brakeman-3.7.2 bundle/ruby/2.3.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/polling.rb
brakeman-3.7.1 bundle/ruby/2.3.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/polling.rb
sass-3.4.25 vendor/listen/lib/listen/adapters/polling.rb
brakeman-3.7.0 bundle/ruby/2.3.0/gems/sass-3.4.24/vendor/listen/lib/listen/adapters/polling.rb
brakeman-3.6.2 bundle/ruby/2.3.0/gems/sass-3.4.24/vendor/listen/lib/listen/adapters/polling.rb
sass-3.4.24 vendor/listen/lib/listen/adapters/polling.rb
brakeman-3.6.1 bundle/ruby/2.3.0/gems/sass-3.4.23/vendor/listen/lib/listen/adapters/polling.rb
brakeman-3.6.0 bundle/ruby/2.3.0/gems/sass-3.4.23/vendor/listen/lib/listen/adapters/polling.rb
brakeman-3.5.0 bundle/ruby/2.3.0/gems/sass-3.4.23/vendor/listen/lib/listen/adapters/polling.rb