简体   繁体   中英

Where can I view the secondary rate limit of GitHub REST api?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM