You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
fix client.reset
This commit is contained in:
@@ -299,6 +299,11 @@ export default class RedisCommandsQueue {
|
||||
});
|
||||
}
|
||||
|
||||
resetDecoder() {
|
||||
this.#resetDecoderCallbacks();
|
||||
this.decoder.reset();
|
||||
}
|
||||
|
||||
#resetFallbackOnReply?: Decoder['onReply'];
|
||||
|
||||
async reset<T extends TypeMapping>(typeMapping?: T) {
|
||||
@@ -384,7 +389,7 @@ export default class RedisCommandsQueue {
|
||||
}
|
||||
|
||||
flushWaitingForReply(err: Error): void {
|
||||
this.decoder.reset();
|
||||
this.resetDecoder();
|
||||
this.#pubSub.reset();
|
||||
|
||||
this.#flushWaitingForReply(err);
|
||||
@@ -402,7 +407,7 @@ export default class RedisCommandsQueue {
|
||||
}
|
||||
|
||||
flushAll(err: Error): void {
|
||||
this.decoder.reset();
|
||||
this.resetDecoder();
|
||||
this.#pubSub.reset();
|
||||
this.#flushWaitingForReply(err);
|
||||
for (const node of this.#toWrite) {
|
||||
|
@@ -429,7 +429,7 @@ export default class RedisClient<
|
||||
try {
|
||||
this.#queue.decoder.write(chunk);
|
||||
} catch (err) {
|
||||
this.#queue.decoder.reset();
|
||||
this.#queue.resetDecoder();
|
||||
this.emit('error', err);
|
||||
}
|
||||
})
|
||||
@@ -899,6 +899,7 @@ export default class RedisClient<
|
||||
async reset() {
|
||||
const promises = [this._self.#queue.reset()];
|
||||
this._self.#handshake(false, promises);
|
||||
this._self.#scheduleWrite();
|
||||
await Promise.all(promises);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user