feat:增加requeest请求速率限制-kimi_k2.5#102
Open
W-Y-NaN wants to merge 1 commit intoSnowfall-in-June:mainfrom
Open
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.
新增 RateLimiter 频率限制器类 (单例模式)
按域名独立计数,不同域名互不影响
使用滑动窗口算法,每分钟自动清理过期请求记录
线程安全,支持多线程并发访问
扩展 SunRequests 类
默认频率限制:每分钟 30 次请求
新增 set_rate_limit(domain, limit_per_minute) 方法:为指定域名设置频率限制
新增 set_default_rate_limit(limit_per_minute) 方法:修改默认频率限制