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

ref #1888 - add disableOfflineQueue (#1900)

* ref #1888 - add disableOfflineQueue

* fix flushQueuesOnError

* update docs

Co-authored-by: Guy Royse <guy@guyroyse.com>

Co-authored-by: Guy Royse <guy@guyroyse.com>
This commit is contained in:
Leibale Eidelman
2022-02-14 15:23:18 -05:00
committed by GitHub
parent 9e904eb862
commit 6dd15d96aa
3 changed files with 6 additions and 2 deletions

View File

@@ -26,6 +26,7 @@ export interface RedisClientOptions<
name?: string;
database?: number;
commandsQueueMaxLength?: number;
disableOfflineQueue?: boolean;
readonly?: boolean;
legacyMode?: boolean;
isolationPoolOptions?: PoolOptions;
@@ -274,7 +275,7 @@ export default class RedisClient<M extends RedisModules, S extends RedisScripts>
.on('data', data => this.#queue.parseResponse(data))
.on('error', err => {
this.emit('error', err);
if (this.#socket.isOpen) {
if (this.#socket.isOpen && !this.#options?.disableOfflineQueue) {
this.#queue.flushWaitingForReply(err);
} else {
this.#queue.flushAll(err);