From 76a9fce7f4af3433d6fb1453d52a06ad76ae4b9f Mon Sep 17 00:00:00 2001 From: "K. Rodman Mannix" Date: Wed, 22 Aug 2018 14:31:30 -0400 Subject: [PATCH 1/2] Request::Retry DEFAULT_EXCEPTIONS constant --- lib/faraday/request/retry.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/faraday/request/retry.rb b/lib/faraday/request/retry.rb index 0d132f188..2a914413b 100644 --- a/lib/faraday/request/retry.rb +++ b/lib/faraday/request/retry.rb @@ -20,6 +20,7 @@ module Faraday # class Request::Retry < Faraday::Middleware + DEFAULT_EXCEPTIONS = [Errno::ETIMEDOUT, 'Timeout::Error', Error::TimeoutError, Faraday::Error::RetriableResponse] IDEMPOTENT_METHODS = [:delete, :get, :head, :options, :put] class Options < Faraday::Options.new(:max, :interval, :max_interval, :interval_randomness, @@ -57,9 +58,7 @@ def backoff_factor end def exceptions - Array(self[:exceptions] ||= [Errno::ETIMEDOUT, 'Timeout::Error', - Error::TimeoutError, - Faraday::Error::RetriableResponse]) + Array(self[:exceptions] ||= DEFAULT_EXCEPTIONS) end def methods From dea17bf7b07630e79b5348303300fde9e2ed3f10 Mon Sep 17 00:00:00 2001 From: "K. Rodman Mannix" Date: Thu, 23 Aug 2018 08:33:42 -0400 Subject: [PATCH 2/2] Add .freeze to DEFAULT_EXCEPTIONS constant --- lib/faraday/request/retry.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/faraday/request/retry.rb b/lib/faraday/request/retry.rb index 2a914413b..5324f6e71 100644 --- a/lib/faraday/request/retry.rb +++ b/lib/faraday/request/retry.rb @@ -20,7 +20,7 @@ module Faraday # class Request::Retry < Faraday::Middleware - DEFAULT_EXCEPTIONS = [Errno::ETIMEDOUT, 'Timeout::Error', Error::TimeoutError, Faraday::Error::RetriableResponse] + DEFAULT_EXCEPTIONS = [Errno::ETIMEDOUT, 'Timeout::Error', Error::TimeoutError, Faraday::Error::RetriableResponse].freeze IDEMPOTENT_METHODS = [:delete, :get, :head, :options, :put] class Options < Faraday::Options.new(:max, :interval, :max_interval, :interval_randomness,