3

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?

  • I dare say there is a reason why it is intentionally vague, so people don't try to game/exploit it. – Jon P Sep 08 '22 at 05:41
  • If they wanted this to be known, they would put the details in their documentation. – Barmar Sep 08 '22 at 05:41
  • I guess that's just how it is, I just find it funny that they are giving a **rate limit** of 5,000 requests per hour for authenticated users, but with my attempt the maximum **rate limit** that I was able to use is around 200+ only because I'm hitting **secondary rate limit**. – himynameisjm Sep 08 '22 at 06:29

1 Answers1

1

You can see secondary rate limits configured on a on-premise GHE (GitHub for Enterprise) instance.

https://docs.github.com/assets/cb-104985/images/enterprise/management-console/secondary-rate-limits-checkbox.png

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250