From fb531b832279884b713cc8a381e8b92f7c9fbbd0 Mon Sep 17 00:00:00 2001 From: mo Date: Sat, 10 Nov 2018 21:36:05 -0700 Subject: revert constant name. --- lib/net/hippie.rb | 9 ++++++--- lib/net/hippie/client.rb | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/net/hippie.rb b/lib/net/hippie.rb index 9a7ea72..6c39a50 100644 --- a/lib/net/hippie.rb +++ b/lib/net/hippie.rb @@ -14,9 +14,12 @@ require 'net/hippie/api' module Net # net/http for hippies. module Hippie - TIMEOUT_ERRORS = [ - EOFError, Errno::ECONNRESET, Errno::EINVAL, - Net::ProtocolError, Timeout::Error + CONNECTION_ERRORS = [ + EOFError, + Errno::ECONNRESET, + Errno::EINVAL, + Net::ProtocolError, + Timeout::Error ].freeze def self.logger diff --git a/lib/net/hippie/client.rb b/lib/net/hippie/client.rb index a140653..e554562 100644 --- a/lib/net/hippie/client.rb +++ b/lib/net/hippie/client.rb @@ -88,7 +88,7 @@ module Net def attempt(attempt, max) yield - rescue *TIMEOUT_ERRORS => error + rescue *CONNECTION_ERRORS => error raise error if attempt == max delay = ((2**attempt) * 0.1) + Random.rand(0.05) # delay + jitter -- cgit v1.2.3