-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
👋 Hello,
I noticed that Client.RateLimits
can return a RateLimitError
, as per:
Lines 648 to 652 in 75644ea
return &RateLimitError{ | |
Rate: rate, | |
Response: resp, | |
Message: fmt.Sprintf("API rate limit of %v still exceeded until %v, not making remote request.", rate.Limit, rate.Reset.Time), | |
} |
According to GitHub REST API documentation, rate limit status can be checked "at any time using the Rate Limit API", i.e. even when the remaining number of allowed requests is 0, and the GET /rate_limit
endpoint never responds with a HTTP 403. I verified myself and I can confirm the documentation is accurate. Therefore, I think Client.RateLimits
should never return RateLimitError
errors and return the actual rate limit status, by performing a HTTP request.
I have 2 solutions in mind:
Client.checkRateLimitBeforeDo
is aware of some allowlist of endpoints, includingGET /rate_limits
(and perhaps others I don't know yet about), for which it should always returnnil
;- a higher layer passes a boolean which indicates that the request should not be subject to the pre-request rate limit check, possibly exposed to the user so one could hit GitHub API regardless of the internal rate limit status.
Happy to discuss any solution before I (or someone else) patch(es) the issue. Thanks!
usmonster
Metadata
Metadata
Assignees
Labels
No labels