Sha256: 8c65ccde17e5fd303a201d75cfc472ee7e2ff6d62c4d323c870d607468af1a42

Contents?: true

Size: 376 Bytes

Versions: 4

Compression:

Stored size: 376 Bytes

Contents

require 'faraday'


module Saddle::Middleware

  # Public: Enforces a ruby timeout on the request
  # :timeout must be present in the request or client options
  class RubyTimeout < Faraday::Middleware

    def call(env)
      timeout = env[:request][:timeout] # nil or 0 means no timeout
      Timeout.timeout(timeout) do
        @app.call(env)
      end
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
saddle-0.0.7 lib/saddle/middleware/ruby_timeout.rb
saddle-0.0.6 lib/saddle/middleware/ruby_timeout.rb
saddle-0.0.5 lib/saddle/middleware/ruby_timeout.rb
saddle-0.0.4 lib/saddle/middleware/ruby_timeout.rb