Skip to content

Instantly share code, notes, and snippets.

@depesz
Created August 4, 2022 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save depesz/379771ce21b65107c0ed216dbb2f14a1 to your computer and use it in GitHub Desktop.
Save depesz/379771ce21b65107c0ed216dbb2f14a1 to your computer and use it in GitHub Desktop.
def repeat_if_limited(&block)
yield
rescue Aws::EC2::Errors::ServiceError => e
real_class = e.class.to_s
if real_class.match %r{RateExceeded$}
backoff
retry
else
raise e
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment