Skip to content

Commit 68d5712

Browse files
fix: make ratelimit timeout require event loop to be active (#8779)
* fix issue with ratelimits not working correctly related to #8757 The ``ref`` option doesn't require the Node.js event loop to remain active when waiting for the timeout causing the program to end if there isn't an active gateway connection. * Update packages/rest/src/lib/handlers/SequentialHandler.ts Co-authored-by: Jiralite <[email protected]> * Update packages/rest/src/lib/handlers/SequentialHandler.ts Co-authored-by: Jiralite <[email protected]> Co-authored-by: Jiralite <[email protected]>
1 parent b2658ce commit 68d5712

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/rest/src/lib/handlers/SequentialHandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export class SequentialHandler implements IHandler {
137137
* @param time - The amount of time to delay all requests for
138138
*/
139139
private async globalDelayFor(time: number): Promise<void> {
140-
await sleep(time, undefined, { ref: false });
140+
await sleep(time);
141141
this.manager.globalDelay = null;
142142
}
143143

@@ -460,7 +460,7 @@ export class SequentialHandler implements IHandler {
460460

461461
this.#sublimitPromise?.resolve();
462462
this.#sublimitPromise = null;
463-
await sleep(sublimitTimeout, undefined, { ref: false });
463+
await sleep(sublimitTimeout);
464464
let resolve: () => void;
465465
// eslint-disable-next-line promise/param-names, no-promise-executor-return
466466
const promise = new Promise<void>((res) => (resolve = res));

0 commit comments

Comments
 (0)