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 #1801
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
@@ -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());
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user