lib/concerns/retryable.rb
# Retry block with custom linear delay.
Retry block with custom linear delay.
Retry block with custom linear delay .
def with_retries(retries: 3, rescue_ex: [StandardError], swallow_ex: false, delay: 0)
    yield
  rescue *rescue_ex => e
    attempts ||= 1
    if attempts <= retries
      sleep delay * attempts
      attempts += 1
      retry
    end
    raise e unless swallow_ex
  end
def with_retries ( retries : 3 , rescue_ex : [ StandardError ] , swallow_ex : false , delay : 0 ) yield rescue * rescue_ex => e attempts ||= 1 if attempts <= retries sleep delay * attempts attempts += 1 retry end raise e unless swallow_ex end
Retry block with custom linear delay.
Retry block with custom linear delay .
retries
<not_specific>
rescue_ex
<not_specific>
swallow_ex
<not_specific>
delay
<not_specific>