Method: Elbas::Retryable#run
- Defined in:
- lib/elbas/retryable.rb
#run(proc) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/elbas/retryable.rb', line 20 def run(proc) attempts ||= 0 attempts += 1 proc.call rescue => e info "Rescued error in retryable action: #{e.}" if attempts < @max info "Retrying in #{@delay} seconds..." sleep @delay retry end end |