This repository was archived by the owner on Oct 22, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed
Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ def initialize
1414
1515 initialize_options
1616 initialize_advanced_options
17+
18+ @hydra = Typhoeus ::Hydra . new ( max_concurrency : max_http_concurrency )
1719 end
1820
1921 # Initialize the basic HTTP options for the module.
@@ -106,6 +108,7 @@ def queue_request(opts, &callback)
106108 end
107109
108110 @hydra . queue req
111+ @hydra . queued_requests
109112 end
110113
111114 # Execute multiple HTTP requests in parallel queued by {#queue_request}.
@@ -179,13 +182,6 @@ def execute_delete_request(opts)
179182 def max_http_concurrency
180183 normalized_option_value ( 'max_http_concurrency' )
181184 end
182-
183- # Run the module.
184- # @return [Boolean] true if the module was successful.
185- def run
186- super
187- @hydra = Typhoeus ::Hydra . new ( max_concurrency : max_http_concurrency )
188- end
189185 end
190186 end
191187end
Original file line number Diff line number Diff line change 342342 expect ( res . headers ) . to eq typhoeus_headers
343343 end
344344 end
345+
346+ describe '#queue_request' do
347+ it 'queues a request to be made later by #execute_queued_requests' do
348+ subject . queue_request ( url : 'http://127.0.0.1/foo' )
349+ queue = subject . queue_request ( url : 'http://127.0.0.1/bar' )
350+ expect ( queue . length ) . to eq 2
351+ end
352+ end
345353end
You can’t perform that action at this time.
0 commit comments