Skip to content

Commit 5086fc5

Browse files
committed
clean listeners
1 parent b0223e7 commit 5086fc5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/client/lib/client/commands-queue.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,10 @@ export default class RedisCommandsQueue {
412412
RedisCommandsQueue.#removeAbortListener(toSend);
413413
toSend.abort = undefined;
414414
}
415+
if (toSend.timeout) {
416+
RedisCommandsQueue.#removeTimeoutListener(toSend);
417+
toSend.timeout = undefined;
418+
}
415419
this.#chainInExecution = toSend.chainId;
416420
toSend.chainId = undefined;
417421
this.#waitingForReply.push(toSend);
@@ -432,10 +436,17 @@ export default class RedisCommandsQueue {
432436
command.abort!.signal.removeEventListener('abort', command.abort!.listener);
433437
}
434438

439+
static #removeTimeoutListener(command: CommandToWrite) {
440+
command.timeout!.signal.removeEventListener('abort', command.timeout!.listener);
441+
}
442+
435443
static #flushToWrite(toBeSent: CommandToWrite, err: Error) {
436444
if (toBeSent.abort) {
437445
RedisCommandsQueue.#removeAbortListener(toBeSent);
438446
}
447+
if (toBeSent.timeout) {
448+
RedisCommandsQueue.#removeTimeoutListener(toBeSent);
449+
}
439450

440451
toBeSent.reject(err);
441452
}

0 commit comments

Comments
 (0)