New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rate limit does not cover all categories & secondary rate limit not preventing requests #2633
Comments
If I'm reading https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#secondary-rate-limits correctly, then the secondary rate limit applies to any following request from that user, and is intended to prevent abuse of their servers (by not following their documented guidelines). Thank you, @gal-legit ! Assigning this issue to you. |
@gmlewis thanks! I'd appreciate your input on my suggestion for an optional user handling for that before I go into writing the code.
This way, clients of the library can opt-in to implement their own handler (e.g. sleep with print) whilst the non-blocking behavior remains the default - and the library doesn't introduce long-blocking actions. also, regarding the |
I'm fine either way. |
I've looked at #2634 and at your above proposal, and both sound good to me. Thank you, @gal-legit ! |
@gmlewis cool, thanks! |
I'm not sure what you mean by "runner registration" or how it relates to this issue, sorry. |
Hey,
First, thanks for all the great work on this client!
I noticed a couple of issues with the rate limits (please let me know if you think I should split it into two issues):
as @gmlewis pointed out in this discussion, all categories should be handled in the
catgory()
function.The current code is:
which is used in:
rateLimitCategory := category(req.URL.Path)
this variable is used in 2 points:
c.checkRateLimitBeforeDo(req, rateLimitCategory)
and
c.rateLimits[rateLimitCategory] = response.Rate
Now, since all categories (but search) are aggregated into the Core category on every request,
the result is that
checkRateLimitBeforeDo
might prevent the user from issuing a request, although the rate limit wasn't reached.I can try to add partial support for that, at least for the fields that are in the documentation or are easy to deduce (e.g. code_scan_upload / integration_manifest)
CheckResponse()
, but not incheckRateLimitBeforeDo()
.As a result, there is no built-in protection against the secondary rate limit, which would be valuable.
I can try to add support for that as well, but I'm not sure to which request the secondary rate limit applies:
I hope someone here might know the answer.
On the same note, I'd be glad to hear your thoughts on implementing an optional 'wait for secondary rate limit' configuration in the client. IMO the use case of waiting for the secondary rate limit is much more common than waiting for the hour-long rate limit (which also isn't supported).
The text was updated successfully, but these errors were encountered: