module Muxer

Muxer is a parallel request module that allows timeouts for each individual request as well as a global timeout for all requests. In addition to the specific timeouts, Muxer will allow a pending request to continue pending even if its timeout has passed as long as there is still a request waiting that has a longer timeout

Constants

VERSION

Public Class Methods

execute() { |multiplexer| ... } click to toggle source

Example Usage:

response = Muxer.execute do |muxer|

muxer.add_url "http://www.rubydoc.info", timeout: 0.5
muxer.add_url "https://www.google.com", timeout: 0.25

end

In the above example, Google’s response could continue pending if rubydoc.info had not yet returned or passed its timeout.

Returns a hash like: “‘ruby {

failed: [],
completed: []

} “‘

@return [Hash]

# File lib/muxer.rb, line 34
def self.execute
  multiplexer = Multiplexer.new

  yield multiplexer if block_given?

  multiplexer.execute
end