File tree 1 file changed +6
-0
lines changed
1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -50,18 +50,22 @@ def read
50
50
end
51
51
end
52
52
53
+ # Implement the Faraday parallel manager interface, using Async.
53
54
class ParallelManager
55
+ # Create a new parallel manager.
54
56
def initialize ( options = { } )
55
57
@options = options
56
58
@barrier = nil
57
59
end
58
60
61
+ # @deprecated Please update your Faraday version!
59
62
def run
60
63
if $VERBOSE
61
64
warn "Please update your Faraday version!" , uplevel : 2
62
65
end
63
66
end
64
67
68
+ # Run the given block asynchronously, using the barrier if available.
65
69
def async ( &block )
66
70
if @barrier
67
71
@barrier . async ( &block )
@@ -70,6 +74,7 @@ def async(&block)
70
74
end
71
75
end
72
76
77
+ # Execute the given block which can perform multiple concurrent requests, waiting for them all to complete.
73
78
def execute ( &block )
74
79
Sync do
75
80
@barrier = Async ::Barrier . new
@@ -87,6 +92,7 @@ def execute(&block)
87
92
class Adapter < ::Faraday ::Adapter
88
93
self . supports_parallel = true
89
94
95
+ # Create a new parallel manager, which is used to handle multiple concurrent requests.
90
96
def self . setup_parallel_manager ( **options )
91
97
ParallelManager . new ( options )
92
98
end
You can’t perform that action at this time.
0 commit comments