Sha256: f081355c12bebfec38b0de2d6a91532aca6dd36f0e606196ff4094d5c8800122

Contents?: true

Size: 177 Bytes

Versions: 3

Compression:

Stored size: 177 Bytes

Contents

def retry_on_timeout(n = 3, &block)
  block.call
rescue => e
  fail if n.zero?
  puts "Catched error: #{e.message}. #{n-1} more attempts."
  retry_on_timeout(n - 1, &block)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
best_in_place-3.0.1 spec/support/retry_on_timeout.rb
best_in_place-3.0.0 spec/support/retry_on_timeout.rb
best_in_place-3.0.0.rc1 spec/support/retry_on_timeout.rb