Module: OpenDMM::HTTParty::ClassMethods

Defined in:
lib/opendmm/utils/httparty.rb

Instance Method Summary collapse

Instance Method Details

#get(path, options = {}, &block) ⇒ Object



23
24
25
26
27
# File 'lib/opendmm/utils/httparty.rb', line 23

def get(path, options={}, &block)
  with_retries do
    super(path, options, &block)
  end
end

#with_retries(&block) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/opendmm/utils/httparty.rb', line 15

def with_retries(&block)
  attempts ||= 0
  yield
rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED => e
  LOGGER.warning e
  (attempts += 1) < 5 ? retry : raise
end