1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00
This commit is contained in:
leibale
2021-12-29 14:28:22 -05:00
parent 611e4100c8
commit 74daee3023
2 changed files with 7 additions and 7 deletions

View File

@@ -721,8 +721,6 @@ describe('Client', () => {
});
testUtils.testWithClient('client.disconnect', async client => {
await client.connect();
const pingPromise = client.ping(),
disconnectPromise = client.disconnect();
assert.equal(client.isOpen, false);
@@ -731,8 +729,10 @@ describe('Client', () => {
assert.doesNotReject(disconnectPromise),
assert.rejects(client.ping(), ClientClosedError)
]);
}, {
...GLOBAL.SERVERS.OPEN,
disableClientSetup: true
});
}, GLOBAL.SERVERS.OPEN);
testUtils.testWithClient('should be able to connect after disconnect (see #1801)', async client => {
await client.disconnect();
await client.connect();
}, GLOBAL.SERVERS.OPEN);
});

View File

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