Skip to content

Commit

Permalink
fixes #2524 delaying graceful exit while pingInterval is set (#2525)
Browse files Browse the repository at this point in the history
* fixes #2524

* `clearTimeout` in `disconnect` too

---------

Co-authored-by: Leibale Eidelman <[email protected]>
  • Loading branch information
jorenvandeweyer and leibale authored Aug 23, 2023
1 parent 259e9b2 commit bc8abd5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/client/lib/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit bc8abd5

Please sign in to comment.