Class: Async::HTTP::Faraday::ParallelManager
- Inherits:
-
Object
- Object
- Async::HTTP::Faraday::ParallelManager
- Defined in:
- lib/async/http/faraday/adapter.rb
Overview
Implement the Faraday parallel manager interface, using Async.
Instance Method Summary collapse
-
#async(&block) ⇒ Object
Run the given block asynchronously, using the barrier if available.
-
#execute(&block) ⇒ Object
Execute the given block which can perform multiple concurrent requests, waiting for them all to complete.
-
#initialize(options = {}) ⇒ ParallelManager
constructor
Create a new parallel manager.
-
#run ⇒ Object
deprecated
Deprecated.
Please update your Faraday version!
Constructor Details
#initialize(options = {}) ⇒ ParallelManager
Create a new parallel manager.
64 65 66 67 |
# File 'lib/async/http/faraday/adapter.rb', line 64 def initialize( = {}) @options = @barrier = nil end |
Instance Method Details
#async(&block) ⇒ Object
Run the given block asynchronously, using the barrier if available.
77 78 79 80 81 82 83 |
# File 'lib/async/http/faraday/adapter.rb', line 77 def async(&block) if @barrier @barrier.async(&block) else Sync(&block) end end |
#execute(&block) ⇒ Object
Execute the given block which can perform multiple concurrent requests, waiting for them all to complete.
86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/async/http/faraday/adapter.rb', line 86 def execute(&block) Sync do @barrier = Async::Barrier.new yield @barrier.wait ensure @barrier&.stop end end |
#run ⇒ Object
Deprecated.
Please update your Faraday version!
70 71 72 73 74 |
# File 'lib/async/http/faraday/adapter.rb', line 70 def run if $VERBOSE warn "Please update your Faraday version!", uplevel: 2 end end |