Skip to content

Commit 74daee3

Browse files
committed
fix #1801
1 parent 611e410 commit 74daee3

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/client/lib/client/index.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -721,8 +721,6 @@ describe('Client', () => {
721721
});
722722

723723
testUtils.testWithClient('client.disconnect', async client => {
724-
await client.connect();
725-
726724
const pingPromise = client.ping(),
727725
disconnectPromise = client.disconnect();
728726
assert.equal(client.isOpen, false);
@@ -731,8 +729,10 @@ describe('Client', () => {
731729
assert.doesNotReject(disconnectPromise),
732730
assert.rejects(client.ping(), ClientClosedError)
733731
]);
734-
}, {
735-
...GLOBAL.SERVERS.OPEN,
736-
disableClientSetup: true
737-
});
732+
}, GLOBAL.SERVERS.OPEN);
733+
734+
testUtils.testWithClient('should be able to connect after disconnect (see #1801)', async client => {
735+
await client.disconnect();
736+
await client.connect();
737+
}, GLOBAL.SERVERS.OPEN);
738738
});

packages/client/lib/client/socket.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export default class RedisSocket extends EventEmitter {
170170
.off('error', reject)
171171
.once('error', (err: Error) => this.#onSocketError(err))
172172
.once('close', hadError => {
173-
if (!hadError && this.#isOpen) {
173+
if (!hadError && this.#isOpen && this.#socket === socket) {
174174
this.#onSocketError(new SocketClosedUnexpectedlyError());
175175
}
176176
})

0 commit comments

Comments
 (0)