Async::HTTP::FaradaySourceAsyncHTTPFaradayParallelManager

class ParallelManager

Implement the Faraday parallel manager interface, using Async.

Definitions

def initialize(options = {})

Create a new parallel manager.

Implementation

def initialize(options = {})
	@options = options
	@barrier = nil
end

def run

  • deprecated

Signature

deprecated

Please update your Faraday version!

Implementation

def run
	if $VERBOSE
		warn "Please update your Faraday version!", uplevel: 2
	end
end

def async(&block)

Run the given block asynchronously, using the barrier if available.

Implementation

def async(&block)
	if @barrier
		@barrier.async(&block)
	else
		Sync(&block)
	end
end

def execute(&block)

Execute the given block which can perform multiple concurrent requests, waiting for them all to complete.

Implementation

def execute(&block)
	Sync do
		@barrier = Async::Barrier.new
		
		yield
		
		@barrier.wait
	ensure
		@barrier&.stop
	end
end