1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

fixes #2524 delaying graceful exit while pingInterval is set (#2525)

* fixes #2524

* `clearTimeout` in `disconnect` too

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
This commit is contained in:
Joren Vandeweyer
2023-08-23 19:20:20 +02:00
committed by GitHub
parent 259e9b2e1f
commit bc8abd5a38

View File

@@ -683,6 +683,7 @@ export default class RedisClient<
QUIT(): Promise<string> {
return this.#socket.quit(async () => {
if (this.#pingTimer) clearTimeout(this.#pingTimer);
const quitPromise = this.#queue.addCommand<string>(['QUIT']);
this.#tick();
const [reply] = await Promise.all([
@@ -804,6 +805,7 @@ export default class RedisClient<
}
async disconnect(): Promise<void> {
if (this.#pingTimer) clearTimeout(this.#pingTimer);
this.#queue.flushAll(new DisconnectsClientError());
this.#socket.disconnect();
await this.#destroyIsolationPool();