Skip to content

quit vs disconnect - flipped behaviour or wrong documentation #2719

Open
@7c

Description

@7c

Description

based on the docs at https://redis.js.org/#node-redis-usage-disconnecting the disconnect should close the connection without flushing and quit close with flushing before closing. Current implementation is not in sync with this approach as seen here

this.#queue.flushAll(new DisconnectsClientError());

for me it looks like reversed, quit seems not try to flush commands but disconnect does.

image

this screenshot demonstrates disconnect behaviour if redis has a ping in the queue, it does try to flush and because ping does not handle .catch it calls 'Unhandled rejection'. We indeed need the .quit() or .disconnect() which should ignore the queue and just close the connection without 'Unhandled rejection' because imagine if you are using third-party-libraries you neven know how people have managed the redis commands..

is this wrong documentation or flipped implementation ?

Node.js Version

20.11.1

Redis Server Version

Node Redis Version

4.6.13

Platform

macOS

Logs

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions