Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save danielwestendorf/a9245ad9dfa38542cc4a3ffaf0fce5a5 to your computer and use it in GitHub Desktop.
Save danielwestendorf/a9245ad9dfa38542cc4a3ffaf0fce5a5 to your computer and use it in GitHub Desktop.
Retriable.retriable(tries: 10, on: [RateLimitReached], intervals: Rails.application.config.retry_intervals) do
res = make_request
if res.status == 429
raise RateLimitReached
else
# process returned invoice
end
end
# application.rb
config.retry_intervals = [1, 5, 10, 15]
# env/test.rb
config.retry_intervals = [0, 0, 0,]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment