From bc8abd5a38110d764b7703bf502b9100b9eaa70f Mon Sep 17 00:00:00 2001 From: Joren Vandeweyer Date: Wed, 23 Aug 2023 19:20:20 +0200 Subject: [PATCH] fixes #2524 delaying graceful exit while pingInterval is set (#2525) * fixes #2524 * `clearTimeout` in `disconnect` too --------- Co-authored-by: Leibale Eidelman --- packages/client/lib/client/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/client/lib/client/index.ts b/packages/client/lib/client/index.ts index 5b9badf3f3..90cdbd0911 100644 --- a/packages/client/lib/client/index.ts +++ b/packages/client/lib/client/index.ts @@ -683,6 +683,7 @@ export default class RedisClient< QUIT(): Promise { return this.#socket.quit(async () => { + if (this.#pingTimer) clearTimeout(this.#pingTimer); const quitPromise = this.#queue.addCommand(['QUIT']); this.#tick(); const [reply] = await Promise.all([ @@ -804,6 +805,7 @@ export default class RedisClient< } async disconnect(): Promise { + if (this.#pingTimer) clearTimeout(this.#pingTimer); this.#queue.flushAll(new DisconnectsClientError()); this.#socket.disconnect(); await this.#destroyIsolationPool();