Skip to content
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

[bug] API rate limit exceeded for server #14

Open
zhicheng-ning opened this issue Feb 15, 2023 · 2 comments
Open

[bug] API rate limit exceeded for server #14

zhicheng-ning opened this issue Feb 15, 2023 · 2 comments
Assignees

Comments

@zhicheng-ning
Copy link
Member

zhicheng-ning commented Feb 15, 2023

#12 中设置每日凌晨 5 点更新 repo statistic 数据后,在服务器中的日志中发现 API 速率超过限制,查看 GitHub API 文档后发现,普通的授权 token 每小时只能发起 5000 次请求。因此在每小时的请求次数耗尽后,该小时内无法再进行请求。

situation:

{
"message": "API rate limit exceeded for 219.78.228.97. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
"documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"
}

reason:

User-to-server requests are limited to 5,000 requests per hour and per authenticated user. All requests from OAuth applications authorized by a user or a personal access token owned by the user, and requests authenticated with any of the user's authentication credentials, share the same quota of 5,000 requests per hour for that user.

image

@zhicheng-ning zhicheng-ning self-assigned this Feb 15, 2023
@zhicheng-ning
Copy link
Member Author

考虑对 token 进行池化,维护一个 GitHub API 的 token 池

@zhicheng-ning
Copy link
Member Author

目前的解决方式是通过配置文件将多个 token 注入到代码中的 token 列表,在进行请求的时候通过轮询顺序从 token 列表中取一个 token 发起请求

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant