From 13c2701463e4b4a6b09952cdd50cd0d82b1e5351 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Tue, 3 May 2016 15:20:58 -0700 Subject: [PATCH] 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. --- github/github.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/github/github.go b/github/github.go index b2de909..c8ec97c 100644 --- a/github/github.go +++ b/github/github.go @@ -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]