Skip to content

Commit

Permalink
Deprecate Client.Rate() method in favor of Response.Rate.
Browse files Browse the repository at this point in the history
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 #347 (comment).
  • Loading branch information
dmitshur committed May 3, 2016
1 parent b07f95e commit 13c2701
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 13c2701

Please sign in to comment.