Module: SpeedLightning::Retryable

Included in:
CheckoutLinkMethods
Defined in:
lib/speed_lightning/retryable.rb

Instance Method Summary collapse

Instance Method Details

#with_retryObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/speed_lightning/retryable.rb', line 4

def with_retry
  should_retry = true
  begin
    yield
  rescue SpeedLightning::Error => e
    if should_retry
      should_retry = false
      sleep 1
      retry
    else
      raise e
    end
  end
end