You've already forked node-redis
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 * handle `error` events in test
This commit is contained in:
@@ -647,6 +647,9 @@ describe('Client', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUtils.testWithClient('should propagated errors from "isolated" clients', client => {
|
testUtils.testWithClient('should propagated errors from "isolated" clients', client => {
|
||||||
|
client.on('error', () => {
|
||||||
|
// ignore errors
|
||||||
|
});
|
||||||
return client.executeIsolated(isolated => killClient(isolated, client));
|
return client.executeIsolated(isolated => killClient(isolated, client));
|
||||||
}, GLOBAL.SERVERS.OPEN);
|
}, GLOBAL.SERVERS.OPEN);
|
||||||
|
|
||||||
|
@@ -199,7 +199,7 @@ export default class RedisSocket extends EventEmitter {
|
|||||||
.off('error', reject)
|
.off('error', reject)
|
||||||
.once('error', (err: Error) => this.#onSocketError(err))
|
.once('error', (err: Error) => this.#onSocketError(err))
|
||||||
.once('close', hadError => {
|
.once('close', hadError => {
|
||||||
if (!hadError && this.#isOpen && this.#socket === socket) {
|
if (!hadError && this.#isReady && this.#socket === socket) {
|
||||||
this.#onSocketError(new SocketClosedUnexpectedlyError());
|
this.#onSocketError(new SocketClosedUnexpectedlyError());
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user