13 Commits

Author SHA1 Message Date
Seefs
5010f2d004 format: package name -> github.com/QuantumNous/new-api (#2017) 2025-10-11 15:30:09 +08:00
CaIon
f14f4eaf1a feat: refactor environment variable initialization and introduce new constant types for API and context keys 2025-07-03 13:10:25 +08:00
creamlike1024
c483c7df5f Merge branch 'tbphp_model_request_rate_limit_for_group' of github.com:tbphp/new-api into tbphp-tbphp_model_request_rate_limit_for_group 2025-05-08 23:16:06 +08:00
tbphp
b648b3cf98 fix: 缩进修复还原 2025-05-05 23:53:05 +08:00
tbphp
cd40bdbdc6 refactor: 调整代码,符合项目现有规范 2025-05-05 19:32:22 +08:00
tbphp
2a0e1ab914 fix: Redis limit ignoring max eq 0 2025-05-05 12:55:48 +08:00
tbphp
c9ce1210be feat: 优化代码,去除多余注释和修改 2025-05-05 11:34:57 +08:00
tbphp
b32ed55624 feat: 增加分组速率功能 2025-05-05 07:31:54 +08:00
霍雨佳
e121e77265 Refactor: Optimize the token bucket algorithm, specifically the New method in common/imiterlimiter.go.
Solution: Remove Redis ping. When printing exceptions, use SysLog to print and add additional logging information.
2025-04-16 16:36:07 +08:00
霍雨佳
5aa2076e18 Refactor: Optimize the request rate limiting for ModelRequestRateLimitCount.
Reason: The original steps 1 and 3 in the redisRateLimitHandler method were not atomic, leading to poor precision under high concurrent requests. For example, with a rate limit set to 60, sending 200 concurrent requests would result in none being blocked, whereas theoretically around 140 should be intercepted.
Solution: I chose not to merge steps 1 and 3 into a single Lua script because a single atomic operation involving read, write, and delete operations could suffer from performance issues under high concurrency. Instead, I implemented a token bucket algorithm to optimize this, reducing the atomic operation to just read and write steps while significantly decreasing the memory footprint.
2025-04-16 10:33:43 +08:00
1808837298@qq.com
fa20af817f refactor: Improve model request rate limit middleware execution 2025-03-06 16:32:11 +08:00
1808837298@qq.com
3f1e340391 refactor: Update rate limit configuration to use dynamic expiration duration 2025-03-02 17:34:39 +08:00
1808837298@qq.com
1763145fea feat: Add model request rate limiting functionality 2025-02-24 16:20:55 +08:00