class Faraday::Connection

def in_parallel(manager = nil, &block)

Returns:
  • (void) -

Other tags:
    Yield: - a block to execute multiple requests.

Parameters:
  • manager (Object) -- The parallel manager that this Connection's
def in_parallel(manager = nil, &block)
  @parallel_manager = manager || default_parallel_manager do
    warn 'Warning: `in_parallel` called but no parallel-capable adapter ' \
         'on Faraday stack'
    warn caller[2, 10].join("\n")
    nil
  end
  return yield unless @parallel_manager
  if @parallel_manager.respond_to?(:execute)
    # Execute is the new method that is responsible for executing the block.
    @parallel_manager.execute(&block)
  else
    # TODO: Old behaviour, deprecate and remove in 3.0
    yield
    @parallel_manager.run
  end
ensure
  @parallel_manager = nil
end