File tree Expand file tree Collapse file tree
lib/api/apiUtils/rateLimit Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414 * - 600 req/s ÷ 6 nodes = 100 req/s per node → interval = 100ms
1515 *
1616 * Dynamic work-stealing is achieved through Redis sync reconciliation:
17- * - Each worker evaluates locally at its fixed per-worker quota
18- * - Workers report consumed / workers to Redis
19- * - Redis sums all workers' shares
20- * - Workers overwrite local counters with Redis values
17+ * - Each worker evaluates locally using preallocated tokens
18+ * - Workers report processed requests to Redis
19+ * - Redis sums all workers' requests
2120 * - Idle workers' unused capacity accumulates in Redis
2221 * - Busy workers pull back higher emptyAt values and throttle proportionally
2322 *
Original file line number Diff line number Diff line change @@ -176,7 +176,9 @@ class WorkerTokenBucket {
176176/**
177177 * Get or create token bucket for a bucket
178178 *
179- * @param {string } bucketName - Bucket name
179+ * @param {string } resourceClass - "bucket" or "account"
180+ * @param {string } resourceId - bucket name or account canonicalId
181+ * @param {string } measure - measure id e.g. "rps"
180182 * @param {object } limitConfig - Rate limit configuration
181183 * @param {object } log - Logger instance
182184 * @returns {WorkerTokenBucket }
@@ -244,7 +246,9 @@ function cleanupTokenBuckets(maxIdleMs = 60000) {
244246/**
245247 * Remove a specific token bucket (used when rate limit config is deleted)
246248 *
247- * @param {string } bucketName - Bucket name
249+ * @param {string } resourceClass - "bucket" or "account"
250+ * @param {string } resourceId - bucket name or account canonicalId
251+ * @param {string } measure - measure id e.g. "rps"
248252 * @returns {boolean } True if bucket was found and removed
249253 */
250254function removeTokenBucket ( resourceClass , resourceId , measure ) {
You can’t perform that action at this time.
0 commit comments