28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/auth0/mixins/httpproxy.rb', line 28
def retry_options
sleep_timer = lambda do |attempt|
wait = BASE_DELAY * (2**attempt-1)
wait += rand(wait+1..wait+MAX_REQUEST_RETRY_JITTER)
wait = [MAX_REQUEST_RETRY_DELAY, wait].min
wait = [MIN_REQUEST_RETRY_DELAY, wait].max
wait / 1000.to_f.round(2)
end
tries = 1 + [Integer(retry_count || DEFAULT_RETRIES), MAX_ALLOWED_RETRIES].min
{
tries: tries,
sleep: sleep_timer,
on: Auth0::RateLimitEncountered
}
end
|