-
Notifications
You must be signed in to change notification settings - Fork 2.1k
With removal of deprecated client.Rate in #555, rate limit info needs more visibility #571
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
Comments
Fixes google#571. Change-Id: Iefcc687d9fc56c40964d5e6f1cdbc54d020dae3c
This change will make it easier and more consistent to check for a rate limit error, using: if resp != nil && resp.Rate.Remaining == 0 {
//...
} |
Just checking, but did you see this sentence in the docs of
Also, the section on rate limiting in the package comment, and the example there? https://godoc.org/github.com/google/go-github/github#hdr-Rate_Limiting So, the way I'd check for rate limit errors is as shown in the provided example in the package documentation at https://godoc.org/github.com/google/go-github/github#hdr-Rate_Limiting: repos, resp, err := client.Repositories.ListByOrg(org, opt)
if err != nil {
if _, ok := err.(*github.RateLimitError); ok {
// ...
}
// ...
} I wanted to ask these questions first before I can comment further. |
That section needs to be updated, since it still refers to a removed deprecated method:
|
Ah, I see. Hmmm... How do you feel about supporting both mechanisms? |
@gmlewis I replied in the PR #572 (review), because I wanted to reference specific lines of code there. |
…Do` (google#572) Return rate limit information immediately after checkRateLimitBeforeDo Fixes google#571.
It used to be that clients might make API calls like:
but after #555, it turns out that
checkRateLimitBeforeDo
will return an error without rate information.I have a PR on the way that addresses this issue.
The text was updated successfully, but these errors were encountered: