Sha256: d5f00524331f84226b672c79dbbd4d2515f82f628715896c8aae1b9b99de02cd
Contents?: true
Size: 719 Bytes
Versions: 23
Compression:
Stored size: 719 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 ] # # 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
23 entries across 23 versions & 1 rubygems