Skip to content

Raise rate limit error with type

James Nutt requested to merge jnutt/rate-limit-with-message into master

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:

  1. 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
  2. Import a personal GitHub project with associated merge requests.
  3. Verify that an ImportFailure record is created with the correct exception_class and exception_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.

Edited by James Nutt

Merge request reports