File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
packages/client/lib/client Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -199,7 +199,7 @@ export default class RedisSocket extends EventEmitter {
199
199
. off ( 'error' , reject )
200
200
. once ( 'error' , ( err : Error ) => this . #onSocketError( err ) )
201
201
. once ( 'close' , hadError => {
202
- if ( ! hadError && this . #isReady && this . #socket === socket ) {
202
+ if ( ! hadError && this . #isOpen && this . #socket === socket ) {
203
203
this . #onSocketError( new SocketClosedUnexpectedlyError ( ) ) ;
204
204
}
205
205
} )
@@ -229,10 +229,11 @@ export default class RedisSocket extends EventEmitter {
229
229
}
230
230
231
231
#onSocketError( err : Error ) : void {
232
+ const wasReady = this . #isReady;
232
233
this . #isReady = false ;
233
234
this . emit ( 'error' , err ) ;
234
235
235
- if ( ! this . #isOpen || typeof this . #shouldReconnect( 0 , err ) !== 'number' ) return ;
236
+ if ( ! wasReady || ! this . #isOpen || typeof this . #shouldReconnect( 0 , err ) !== 'number' ) return ;
236
237
237
238
this . emit ( 'reconnecting' ) ;
238
239
this . #connect( ) . catch ( ( ) => {
You can’t perform that action at this time.
0 commit comments