Skip to content

Commit 13c2701

Browse files
committed
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 #347 (comment).
1 parent b07f95e commit 13c2701

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎github/github.go‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,10 @@ func parseRate(r *http.Response) Rate {
320320

321321
// Rate specifies the current rate limit for the client as determined by the
322322
// most recent API call. If the client is used in a multi-user application,
323-
// this rate may not always be up-to-date. Call RateLimits() to check the
324-
// current rate.
323+
// this rate may not always be up-to-date.
324+
//
325+
// Deprecated: Use the Response.Rate returned from most recent API call instead.
326+
// Call RateLimits() to check the current rate.
325327
func (c *Client) Rate() Rate {
326328
c.rateMu.Lock()
327329
rate := c.rateLimits[c.mostRecent]

0 commit comments

Comments
 (0)