Browse Source

Deprecate Client.Rate() method in favor of Response.Rate.

Client.Rate() method is unreliable in situations when API calls are made
by others that may hit different rate limit categories (core and search).
Each API call already returns a Response struct that contains an accurate
Rate, so that's a better mechanism to access this information.

See relevant discussion at https://github.com/google/go-github/pull/347#discussion_r61920849.
Dmitri Shuralyov 10 years ago
parent
commit
13c2701463
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      github/github.go

+ 4
- 2
github/github.go View File

@ -320,8 +320,10 @@ func parseRate(r *http.Response) Rate {
// Rate specifies the current rate limit for the client as determined by the
// most recent API call. If the client is used in a multi-user application,
// this rate may not always be up-to-date. Call RateLimits() to check the
// current rate.
// this rate may not always be up-to-date.
//
// Deprecated: Use the Response.Rate returned from most recent API call instead.
// Call RateLimits() to check the current rate.
func (c *Client) Rate() Rate {
c.rateMu.Lock()
rate := c.rateLimits[c.mostRecent]


Loading…
Cancel
Save