Method: Blat::Queue#initialize
- Defined in:
- lib/blat/queue.rb
#initialize(max_connections, pipeline = true) ⇒ Queue
Create a new Blat::Queue with a given number of maximum connections.
The ‘pipeline’ options controls Curl::Multi’s pipelining feature, which tries to use the same http connection for many requests to the same server.
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/blat/queue.rb', line 22 def initialize(max_connections, pipeline = true) @multi = Curl::Multi.new # Set properties @max_connects = max_connections.to_i @pipeline = (pipeline == true) @multi.max_connects = @max_connects @multi.pipeline = @pipeline # Keep track of activity @active = false @activity_mx = Mutex.new end |