Skip to content

Commit f8c24c0

Browse files
committed
1 parent 2ca6e1f commit f8c24c0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/client/lib/client/socket.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,11 @@ export default class RedisSocket extends EventEmitter {
217217
}
218218

219219
private _onSocketError(err: Error): void {
220+
const wasReady = this._isReady;
220221
this._isReady = false;
221222
this.emit('error', err);
222223

223-
if (!this._isOpen || typeof this._shouldReconnect(0, err) !== 'number') return;
224+
if (!wasReady || !this._isOpen || typeof this._shouldReconnect(0, err) !== 'number') return;
224225

225226
this.emit('reconnecting');
226227
this._connect().catch(() => {

0 commit comments

Comments
 (0)