module HTTPX::Plugins::Retries

  1. lib/httpx/plugins/retries.rb

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

gitlab.com/honeyryderchuck/httpx/wikis/Retries

Methods

Public Class

  1. extra_options

Constants

IDEMPOTENT_METHODS = %i[get options head put delete].freeze  

TODO: pass max_retries in a configure/load block

MAX_RETRIES = 3  
RETRYABLE_ERRORS = [IOError, EOFError, Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPIPE, (OpenSSL::SSL::SSLError if defined?(OpenSSL)), TimeoutError, Parser::Error, Errno::EINVAL, Errno::ETIMEDOUT].freeze  

Public Class methods

extra_options (options)
[show source]
   # File lib/httpx/plugins/retries.rb
26 def self.extra_options(options)
27   Class.new(options.class) do
28     def_option(:max_retries) do |num|
29       num = Integer(num)
30       raise Error, ":max_retries must be positive" unless num.positive?
31 
32       num
33     end
34 
35     def_option(:retry_change_requests)
36   end.new(options).merge(max_retries: MAX_RETRIES)
37 end