Class: Retry
- Inherits:
-
Object
- Object
- Retry
- Defined in:
- lib/retry.rb
Class Method Summary collapse
Class Method Details
.!(block, attempt = 0) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# File 'lib/retry.rb', line 2 def self.!(block, attempt=0) logger = Logger.get self logger.debug "Executing #{block}, attempt: #{attempt}" begin block.call(attempt) rescue RetryableError => e logger.info "Exception in #{block}, retrying" attempt += 1 Retry.!(block, attempt) end end |