-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding in handling for secondary rate limit exceptions #2473
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting this PR together! ❤️
Octokit/Http/Connection.cs
Outdated
@@ -719,7 +719,7 @@ static Exception GetExceptionForForbidden(IResponse response) | |||
{ | |||
string body = response.Body as string ?? ""; | |||
|
|||
if (body.Contains("rate limit exceeded")) | |||
if (body.Contains("rate limit exceeded") || body.Contains("secondary rate limit")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it might be better throw a different kind of exception for a secondary rate limit. What do you think? I'm just thinking that it would make it easier to handle this specific case as a caller, without doing string matching.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get where you are coming from, makes sense to me :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’d just define a new exception and raise that. It should be a quick change, and then we can get this approved and merged ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed it to be it's own exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Let me just tag in @nickfloyd who is more of a C# expert than me, and then we can get this merged hopefully. Thanks for your contribution ❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for getting this done! ❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just learned to answer you I'll take it and run it on server see what it does get back to you.
@@ -180,7 +180,7 @@ public async Task ThrowsApiValidationExceptionFor422Response() | |||
} | |||
|
|||
[Fact] | |||
public async Task ThrowsRateLimitExceededExceptionForForbidderResponse() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
release_notes: Adds handling for secondary rate limit exceptions from the GitHub REST API |
fixes #2466