Sha256: 9ff6f130e2be47fa86e1c12c0620126f67d58d4eb1aecfbba5f7d79d64470276

Contents?: true

Size: 632 Bytes

Versions: 7

Compression:

Stored size: 632 Bytes

Contents

module Excon
  module Middleware
    class Idempotent < Excon::Middleware::Base
      def error_call(datum)
        if datum[:idempotent] && [Excon::Errors::Timeout, Excon::Errors::SocketError,
            Excon::Errors::HTTPStatusError].any? {|ex| datum[:error].kind_of?(ex) } && datum[:retries_remaining] > 1
          # reduces remaining retries, reset connection, and restart request_call
          datum[:retries_remaining] -= 1
          datum[:connection].reset
          datum.delete(:error)
          datum[:connection].request(datum)
        else
          @stack.error_call(datum)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
excon-0.20.0 lib/excon/middlewares/idempotent.rb
excon-0.19.5 lib/excon/middlewares/idempotent.rb
excon-0.19.4 lib/excon/middlewares/idempotent.rb
excon-0.19.3 lib/excon/middlewares/idempotent.rb
excon-0.19.2 lib/excon/middlewares/idempotent.rb
excon-0.19.1 lib/excon/middlewares/idempotent.rb
excon-0.19.0 lib/excon/middlewares/idempotent.rb