Sha256: d6113316250f7707208437a48bbdb80d13556d38734674a985ef7394523190db
Contents?: true
Size: 763 Bytes
Versions: 11
Compression:
Stored size: 763 Bytes
Contents
# frozen_string_literal: true module Mihari module Mixins module Retriable DEFAULT_ON = [ Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPIPE, OpenSSL::SSL::SSLError, Timeout::Error, RetryableError, NetworkError, TimeoutError ] # # Retry on error # # @param [Integer] times # @param [Integer] interval # @param [Array<StandardError>] on # # @return [nil] # def retry_on_error(times: 3, interval: 5, on: DEFAULT_ON) try = 0 begin try += 1 yield rescue *on => e sleep interval retry if try < times raise e end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems