Quality Coverage Build Dependencies Docs Downloads Tags Releases Issues License Version

Muxer is a gem to allow web requests to run in parallel with seperate timeouts per request, in addition to an optional global timeout for all of the requests.

For example:

  • Request 1 (Internal API) - 5 second timeout
  • Request 2 (External) - 1 second timeout
  • Request 3 (External) - 1 second timeout
  • Request 4 (External) - 1 second timeout

Requests 2-4 will be allowed to continue waiting after their timeouts if we are still waiting on Request 1; however, if Request 1 comes back in half a second, we will finish ALL requests at the 1 second timeout. Any requests not finished within the timeouts will be added to the :failed array in the response.


Add this line to your application's Gemfile:

gem 'muxer'

And then execute:

$ bundle

Or install it yourself as:

$ gem install muxer


response = Muxer.execute do |muxer|
  muxer.add_url ""
  muxer.add_url ""

response[:failed] == []
response[:succeeded] == [
  Muxer::Request(url: ""),
  Muxer::Request(url: "")


  1. Fork it ([my-github-username]/muxer/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request