Sha256: aca78591ddbbfae131ac9e73417044c0c4f42dac938246471cb04b901b05b392
Contents?: true
Size: 329 Bytes
Versions: 4
Compression:
Stored size: 329 Bytes
Contents
module Sym module Extensions module WithRetry def with_retry(retries: 3, fail_block: nil) attempts = 0 yield if block_given? rescue StandardError => e raise(e) if attempts >= retries fail_block.call if fail_block attempts += 1 retry end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
sym-3.0.2 | lib/sym/extensions/with_retry.rb |
sym-3.0.1 | lib/sym/extensions/with_retry.rb |
sym-3.0.0 | lib/sym/extensions/with_retry.rb |
sym-2.10.0 | lib/sym/extensions/with_retry.rb |