Rescue Octokit::NotFound inside the UserFinder and cache the inexistence of the user
The following discussion from !106266 (merged) should be addressed:
-
@rodrigo.tomonari started a discussion:
I wonder if we should add the rescue inside the UserFinder and also cache the inexistence of the user
If we don't cache, we will make several requests to the GitHub API fetching the same information.
Technical details
In Gitlab::GithubImport::UserFinder
we make request to the GitHub API in the #email_for_github_username method to fetch the user's email. In case the user cannot be found on GitHub (for whatever reason), it will raise the Octokit::NotFound
exception.
We should catch the exception and cache the inexistence of the user with the specified login so we don't make the same requests during the GitHub project import. Then we should remove rescuing of this exception in our importers (e.g. Gitlab::GithubImport::Importer::PullRequestReviewImporter
).