Method: Ferrum::Utils::Attempt.with_retry

Defined in:
lib/ferrum/utils/attempt.rb

.with_retry(errors:, max:, wait:) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/ferrum/utils/attempt.rb', line 8

def with_retry(errors:, max:, wait:)
  attempts ||= 1
  yield
rescue *Array(errors)
  raise if attempts >= max

  attempts += 1
  sleep(wait)
  retry
end