Module: HTTPX::Plugins::Retries
- Defined in:
- lib/httpx/plugins/retries.rb
Overview
This plugin adds support for retrying requests when certain errors happen.
Defined Under Namespace
Modules: InstanceMethods, RequestMethods
Constant Summary collapse
- MAX_RETRIES =
3
- IDEMPOTENT_METHODS =
TODO: pass max_retries in a configure/load block
%i[get options head put delete].freeze
- RETRYABLE_ERRORS =
[IOError, EOFError, Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPIPE, (OpenSSL::SSL::SSLError if defined?(OpenSSL)), TimeoutError, Parser::Error, Errno::EINVAL, Errno::ETIMEDOUT].freeze
Class Method Summary collapse
Class Method Details
.extra_options(options) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/httpx/plugins/retries.rb', line 26 def self.() Class.new(.class) do def_option(:max_retries) do |num| num = Integer(num) raise Error, ":max_retries must be positive" unless num.positive? num end def_option(:retry_change_requests) end.new().merge(max_retries: MAX_RETRIES) end |