Module: HTTPX::Plugins::Retries

Defined in:
lib/httpx/plugins/retries.rb

Overview

This plugin adds support for retrying requests when certain errors happen.

gitlab.com/os85/httpx/wikis/Retries

Defined Under Namespace

Modules: InstanceMethods, OptionsMethods, RequestMethods, ResponseMethods

Constant Summary collapse

MAX_RETRIES =
3
IDEMPOTENT_METHODS =

TODO: pass max_retries in a configure/load block

%w[GET OPTIONS HEAD PUT DELETE].freeze
RETRYABLE_ERRORS =
[
  IOError,
  EOFError,
  Errno::ECONNRESET,
  Errno::ECONNABORTED,
  Errno::EPIPE,
  Errno::EINVAL,
  Errno::ETIMEDOUT,
  Parser::Error,
  TLSError,
  TimeoutError,
  ConnectionError,
  Connection::HTTP2::GoawayError,
].freeze
DEFAULT_JITTER =
->(interval) { interval * ((rand + 1) * 0.5) }

Class Method Summary collapse

Class Method Details

.extra_options(options) ⇒ Object



32
33
34
# File 'lib/httpx/plugins/retries.rb', line 32

def self.extra_options(options)
  options.merge(max_retries: MAX_RETRIES)
end