Sha256: 7f023fe1c9023d6d421376801e7156feaa3de1611349fa6efd508d1ceb70f83f

Contents?: true

Size: 587 Bytes

Versions: 12

Compression:

Stored size: 587 Bytes

Contents

module Typhoeus
  class Hydra

    # This module contains logic to run a hydra.
    module Runnable

      # Start the hydra run.
      #
      # @example Start hydra run.
      #   hydra.run
      #
      # @return [ Symbol ] Return value from multi.perform.
      def run
        number_requests = 0
        loop do
          break if number_requests == max_concurrency || queued_requests.empty?
          number_requests += queued_requests.pop(max_concurrency).map do |request|
            add(request)
          end.size
        end
        multi.perform
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
typhoeus-0.6.8 lib/typhoeus/hydra/runnable.rb
typhoeus-0.6.7 lib/typhoeus/hydra/runnable.rb
typhoeus-0.6.6 lib/typhoeus/hydra/runnable.rb
typhoeus-0.6.5 lib/typhoeus/hydra/runnable.rb
typhoeus-0.6.4 lib/typhoeus/hydra/runnable.rb
typhoeus-0.6.3 lib/typhoeus/hydra/runnable.rb
typhoeus-0.6.2 lib/typhoeus/hydra/runnable.rb
typhoeus-0.6.1 lib/typhoeus/hydra/runnable.rb
typhoeus-0.6.0 lib/typhoeus/hydra/runnable.rb
typhoeus-0.6 lib/typhoeus/hydra/runnable.rb
typhoeus-0.5.4 lib/typhoeus/hydra/runnable.rb
typhoeus-0.5.3 lib/typhoeus/hydra/runnable.rb