Sha256: 879523fe900a3c3ff51d26580e56d463f0d970f7bc5076258b90e98591f9a51e

Contents?: true

Size: 374 Bytes

Versions: 15

Compression:

Stored size: 374 Bytes

Contents

# frozen_string_literal: true

module Mihari
  module Retriable
    def retry_on_error(times: 3, interval: 10)
      try = 0
      begin
        try += 1
        yield
      rescue Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPIPE, OpenSSL::SSL::SSLError, Timeout::Error => _e
        sleep interval
        retry if try < times
        raise
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
mihari-1.2.0 lib/mihari/retriable.rb
mihari-1.1.1 lib/mihari/retriable.rb
mihari-1.1.0 lib/mihari/retriable.rb
mihari-1.0.1 lib/mihari/retriable.rb
mihari-1.0.0 lib/mihari/retriable.rb
mihari-0.17.5 lib/mihari/retriable.rb
mihari-0.17.4 lib/mihari/retriable.rb
mihari-0.17.3 lib/mihari/retriable.rb
mihari-0.17.2 lib/mihari/retriable.rb
mihari-0.17.1 lib/mihari/retriable.rb
mihari-0.17.0 lib/mihari/retriable.rb
mihari-0.16.0 lib/mihari/retriable.rb
mihari-0.15.0 lib/mihari/retriable.rb
mihari-0.14.0 lib/mihari/retriable.rb
mihari-0.13.2 lib/mihari/retriable.rb