Module: Typhoeus::Hydra::Runnable

Included in:
Typhoeus::Hydra
Defined in:
lib/typhoeus/hydra/runnable.rb

Overview

This module contains logic to run a hydra.

Since:

  • 0.5.0

Instance Method Summary collapse

Instance Method Details

#runSymbol

Start the hydra run.

Examples:

Start hydra run.

hydra.run

Returns:

  • (Symbol)

    Return value from multi.perform.

Since:

  • 0.5.0



13
14
15
16
17
18
19
20
21
22
# File 'lib/typhoeus/hydra/runnable.rb', line 13

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