Kimi K2.5 给所有通过request获取数据的接口加上频率限制#89
Open
w60031872 wants to merge 5 commits intoSnowfall-in-June:mainfrom
Open
Kimi K2.5 给所有通过request获取数据的接口加上频率限制#89w60031872 wants to merge 5 commits intoSnowfall-in-June:mainfrom
w60031872 wants to merge 5 commits intoSnowfall-in-June:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
功能要求
所有通过request获取数据的接口加上频率限制,同一个域名每分钟默认控制30次请求,次数要求可以通过方法设置,尽可能少改代码,尽可能代码实现优雅。
步骤:
在 SunRequests 类中添加域名频率限制功能
添加设置域名频率限制的方法
导出新的方法供外部使用
验证代码正缺性
优点
代码改动小 只新增了DomainRateLimiter类,对原有代码影响小。
配置灵活,支持链式调用,
整体满意度为5分