I’m trying to create something with GitHub’s REST api using Octokit, but I’m having trouble dealing with their secondary rate limit, I wonder where can I view this secondary rate limit, or know exactly how they work? The documentation seems to be very vague about the inner workings of this said secondary rate limit.
The rate limits can be viewed using the endpoint below, but it does not include the secondary rate limit.
await octokit.request('GET /rate_limit', {})
Also the documentation only provides best practices to avoid this secondary rate limit, but even this does not help.
Specifically I’m constantly using their follow a user endpoint every 2 seconds and doing a 5 minute sleep after 24 requests, but at some point I’m still hitting this secondary rate limit.
await octokit.request('PUT /user/following/{username}', { username: 'USERNAME' })
At this point, the only solution that I can think of is to slow down even further with the requests, but that is not optimal.
I wonder If GitHub has a way to view this secondary rate limit so I can deal with it programmatically, or on a much clearer way?
Advertisement
Answer
You can see secondary rate limits configured on a on-premise GHE (GitHub for Enterprise) instance.
Type limits for:
- Total Requests,
- CPU Limit, and
- CPU Limit for Searching,
or accept the pre-filled default limits.
But even that instance does not have an exposed API to configure those elements: web page interface only.