impr(CLDSRV-852): Refactor WorkerTokenBucket#6108
impr(CLDSRV-852): Refactor WorkerTokenBucket#6108tmacro wants to merge 13 commits intoimprovement/CLDSRV-852/refactor_cachefrom
Conversation
❌ 105 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
446cb3b to
ee952c3
Compare
|
LGTM |
4b83cef to
b40ff80
Compare
…urceClass, resourceId, and measure
- Change constructor to accept resourceClass, resourceId, measure - Precalculate interval for reuse in constructor - Add hasCapacity() method - Add updateLimit() method to encasulate limit change logic - Remove unused mechanism to record request durations - Simplify refill logic
ee952c3 to
a68c32e
Compare
| // Per-node rate = limit / nodes (workers NOT divided) | ||
| // This allows dynamic work-stealing - workers evaluate at node quota | ||
|
|
||
| function calculateInterval(limit, nodes) { |
There was a problem hiding this comment.
calculateInterval now accepts only 2 params (limit, nodes) — the workers param was removed. However, lib/api/apiUtils/rateLimit/config.js:232 still calls calculateInterval(limit, nodes, clusters) with 3 args. The third arg is silently ignored, so the interval no longer accounts for worker count. If intentional, config.js needs its comments and validation message updated. If not, this is a rate limiting bug.
— Claude Code
| * Examples: | ||
| * - 100 req/s ÷ 1 node ÷ 10 workers = 10 req/s per worker → interval = 100ms | ||
| * - 600 req/s ÷ 6 nodes ÷ 10 workers = 10 req/s per worker → interval = 100ms | ||
| * - 100 req/s ÷ 1 node = 100 req/s per node → interval = 100ms |
There was a problem hiding this comment.
The examples are incorrect after removing the workers divisor. 100 req/s ÷ 1 node = 100 req/s per node → interval = 1000/100 = 10ms, not 100ms. Similarly 600 req/s ÷ 6 nodes = 100 req/s per node → interval = 10ms, not 100ms. These values were correct when workers (10) was part of the formula but weren't updated.
— Claude Code
Review by Claude Code |
b40ff80 to
100976b
Compare
Note for revewers: S3 API unit tests are still expected to fail