Open bitwiseman opened 1 day ago
I'm getting this error from two different locations when I attempt to search at all. Something appears to have gone sideways with the implementation.
I understand the need for ratelimiting, but this doesn't seem like it was tested thoroughly enough prior to release.
See #1805
See #1842
This docs page describes secondary rate limit behavior: https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#about-secondary-rate-limits
As of this reading it says:
These are incredibly loosely defined guides and you cannot query for them ahead of time. 👎 It looks like we need to take the path some users have suggested and make rate limiting much more resilient, potentially allowing users to write their own rate limit strategies for handling secondary rate limits.
The current internal
GitHubRateLimitChecker
would need to be replaced by aPrimaryGitHubRateLimiter
which extends a newGitHubRateLimiter
class/interface. Then each of the above bullet points would a new rate limiter class. All of them would need to be called before and after each query, and maintain their own configuration and calculated state.GitHubRateLimiter
would provide the API and possibly helper functions to make that easier to do right.I think the basic API would be that the method call before a request is sent, would return an
Optional<Duration>
and if more than one limiter returns a Duration the longest one is used. Or maybe return an option record that includes areason
message and a duration, perhaps also a logLevel/severity. Make it easier to produce meaningful output.