From f91bcba76a2ce470f116facbe5587b5bf337897a Mon Sep 17 00:00:00 2001 From: Erdem Date: Thu, 17 Jul 2025 22:49:24 +0300 Subject: [PATCH 1/3] fix --- packages/rest/src/lib/handlers/SequentialHandler.ts | 5 ++--- packages/rest/src/lib/utils/utils.ts | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/rest/src/lib/handlers/SequentialHandler.ts b/packages/rest/src/lib/handlers/SequentialHandler.ts index af1b2fa78050..fb887577f26c 100644 --- a/packages/rest/src/lib/handlers/SequentialHandler.ts +++ b/packages/rest/src/lib/handlers/SequentialHandler.ts @@ -158,10 +158,9 @@ export class SequentialHandler implements IHandler { const wait = queue.wait(); this.#asyncQueue.shift(); await wait; - } else if (this.#sublimitPromise) { - // Stall requests while the sublimit queue gets processed - await this.#sublimitPromise.promise; } + // Note: Removed the "else if (this.#sublimitPromise)" block to allow non-sublimited requests + // to proceed independently of the sublimit queue } try { diff --git a/packages/rest/src/lib/utils/utils.ts b/packages/rest/src/lib/utils/utils.ts index e658210452f8..e543abbf25a8 100644 --- a/packages/rest/src/lib/utils/utils.ts +++ b/packages/rest/src/lib/utils/utils.ts @@ -79,8 +79,8 @@ export function hasSublimit(bucketRoute: string, body?: unknown, method?: string return ['name', 'topic'].some((key) => Reflect.has(castedBody, key)); } - // If we are checking if a request has a sublimit on a route not checked above, sublimit all requests to avoid a flood of 429s - return true; + // Only return true for explicitly known sublimited routes to avoid unnecessarily sublimiting requests + return false; } /** From 795601144b6edb888ef76ab0c63cbf4bea06d885 Mon Sep 17 00:00:00 2001 From: Erdem Date: Thu, 17 Jul 2025 23:48:43 +0300 Subject: [PATCH 2/3] Revert "fix" This reverts commit f91bcba76a2ce470f116facbe5587b5bf337897a. --- packages/rest/src/lib/handlers/SequentialHandler.ts | 5 +++-- packages/rest/src/lib/utils/utils.ts | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/rest/src/lib/handlers/SequentialHandler.ts b/packages/rest/src/lib/handlers/SequentialHandler.ts index fb887577f26c..af1b2fa78050 100644 --- a/packages/rest/src/lib/handlers/SequentialHandler.ts +++ b/packages/rest/src/lib/handlers/SequentialHandler.ts @@ -158,9 +158,10 @@ export class SequentialHandler implements IHandler { const wait = queue.wait(); this.#asyncQueue.shift(); await wait; + } else if (this.#sublimitPromise) { + // Stall requests while the sublimit queue gets processed + await this.#sublimitPromise.promise; } - // Note: Removed the "else if (this.#sublimitPromise)" block to allow non-sublimited requests - // to proceed independently of the sublimit queue } try { diff --git a/packages/rest/src/lib/utils/utils.ts b/packages/rest/src/lib/utils/utils.ts index e543abbf25a8..e658210452f8 100644 --- a/packages/rest/src/lib/utils/utils.ts +++ b/packages/rest/src/lib/utils/utils.ts @@ -79,8 +79,8 @@ export function hasSublimit(bucketRoute: string, body?: unknown, method?: string return ['name', 'topic'].some((key) => Reflect.has(castedBody, key)); } - // Only return true for explicitly known sublimited routes to avoid unnecessarily sublimiting requests - return false; + // If we are checking if a request has a sublimit on a route not checked above, sublimit all requests to avoid a flood of 429s + return true; } /** From 6adec6a48db4c711dc6c158fc512a3b04bce1a2a Mon Sep 17 00:00:00 2001 From: Erdem Date: Thu, 17 Jul 2025 23:52:28 +0300 Subject: [PATCH 3/3] proper fix --- packages/rest/src/lib/handlers/SequentialHandler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rest/src/lib/handlers/SequentialHandler.ts b/packages/rest/src/lib/handlers/SequentialHandler.ts index af1b2fa78050..33effea91712 100644 --- a/packages/rest/src/lib/handlers/SequentialHandler.ts +++ b/packages/rest/src/lib/handlers/SequentialHandler.ts @@ -158,7 +158,7 @@ export class SequentialHandler implements IHandler { const wait = queue.wait(); this.#asyncQueue.shift(); await wait; - } else if (this.#sublimitPromise) { + } else if (this.#sublimitPromise && hasSublimit(routeId.bucketRoute, requestData.body, options.method)) { // Stall requests while the sublimit queue gets processed await this.#sublimitPromise.promise; }