mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
Use faraday retry, move retry logic to concrete provider level (#2042)
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
module Retryable
|
||||
def retrying(retryable_errors = [], max_retries: 3)
|
||||
attempts = 0
|
||||
|
||||
begin
|
||||
on_last_attempt = attempts == max_retries - 1
|
||||
|
||||
yield on_last_attempt
|
||||
rescue *retryable_errors => e
|
||||
attempts += 1
|
||||
|
||||
if attempts < max_retries
|
||||
retry
|
||||
else
|
||||
raise e
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user