Sha256: bac87c4a459be34b14f869cafa4aa809c6cda9662a3d0d9c81216bd3f940620b
Contents?: true
Size: 733 Bytes
Versions: 11
Compression:
Stored size: 733 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 # 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