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.
62 63 64 65 |
# File 'lib/async/http/faraday/adapter.rb', line 62 def initialize( = {}) @options = @barrier = nil end |
Instance Method Details
#async(&block) ⇒ Object
Run the given block asynchronously, using the barrier if available.
75 76 77 78 79 80 81 |
# File 'lib/async/http/faraday/adapter.rb', line 75 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.
84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/async/http/faraday/adapter.rb', line 84 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!
68 69 70 71 72 |
# File 'lib/async/http/faraday/adapter.rb', line 68 def run if $VERBOSE warn "Please update your Faraday version!", uplevel: 2 end end |