Raise rate limit error with type
What does this MR do and why?
Raise rate limit error with type
This change is intended to improve logging when rate limits are hit during a GitHub import. We will now be able to tell by the logs whether the limit hit was our own internal threshold, a primary GitHub limit, or a secondary GitHub limit.
Changelog: other
Related issue: #428065 (closed)
How to set up and validate locally
Since this relies on GitHub's rate limiting, I'm not sure how to create a 1:1 recreation. What I did was:
- Update
lib/gitlab/github_import/client.rb:103
to return an Octokit error with the appropriate message:with_rate_limit do raise ::Octokit::TooManyRequests.new(body: 'primary limit reached') end
- Import a personal GitHub project with associated merge requests.
- Verify that an
ImportFailure
record is created with the correctexception_class
andexception_message
values.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by James Nutt