1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

fix #2443 - fix multiple sockets on error in socket initiator (#2480)

* fix #2443 - fix multiple sockets on error in socket initiator

* handle `error` events in test
This commit is contained in:
Leibale Eidelman
2023-04-26 12:56:42 -04:00
committed by GitHub
parent e1658ba6ef
commit ba31c8a50e
2 changed files with 4 additions and 1 deletions

View File

@@ -647,6 +647,9 @@ describe('Client', () => {
});
testUtils.testWithClient('should propagated errors from "isolated" clients', client => {
client.on('error', () => {
// ignore errors
});
return client.executeIsolated(isolated => killClient(isolated, client));
}, GLOBAL.SERVERS.OPEN);

View File

@@ -199,7 +199,7 @@ export default class RedisSocket extends EventEmitter {
.off('error', reject)
.once('error', (err: Error) => this.#onSocketError(err))
.once('close', hadError => {
if (!hadError && this.#isOpen && this.#socket === socket) {
if (!hadError && this.#isReady && this.#socket === socket) {
this.#onSocketError(new SocketClosedUnexpectedlyError());
}
})