lib/retriable.rb in retriable-3.1.1 vs lib/retriable.rb in retriable-3.1.2
- old
+ new
@@ -35,10 +35,11 @@
timeout = local_config.timeout
on = local_config.on
on_retry = local_config.on_retry
sleep_disabled = local_config.sleep_disabled
+ exception_list = on.is_a?(Hash) ? on.keys : on
start_time = Time.now
elapsed_time = -> { Time.now - start_time }
if intervals
tries = intervals.size + 1
@@ -50,13 +51,12 @@
max_interval: max_interval,
rand_factor: rand_factor
).intervals
end
- exception_list = on.is_a?(Hash) ? on.keys : on
-
tries.times do |index|
try = index + 1
+
begin
return Timeout.timeout(timeout) { return yield(try) } if timeout
return yield(try)
rescue *[*exception_list] => exception
if on.is_a?(Hash)