File tree 2 files changed +9
-7
lines changed
2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -337,7 +337,7 @@ Cluster.prototype.refreshSlotsCache = function (callback) {
337
337
} ;
338
338
339
339
/**
340
- * Flush offline queue and command queue with error.
340
+ * Flush offline queue with error.
341
341
*
342
342
* @param {Error } error - The error object to send to the commands
343
343
* @private
Original file line number Diff line number Diff line change @@ -315,9 +315,6 @@ Redis.prototype.disconnect = function (reconnect) {
315
315
if ( this . status === 'wait' ) {
316
316
eventHandler . closeHandler ( this ) ( ) ;
317
317
} else {
318
- if ( this . stream ) {
319
- this . stream . removeAllListeners ( 'data' ) ;
320
- }
321
318
this . connector . disconnect ( ) ;
322
319
}
323
320
} ;
@@ -359,9 +356,14 @@ Redis.prototype.flushQueue = function (error) {
359
356
item . command . reject ( error ) ;
360
357
}
361
358
362
- while ( this . commandQueue . length > 0 ) {
363
- item = this . commandQueue . shift ( ) ;
364
- item . command . reject ( error ) ;
359
+ if ( this . commandQueue . length > 0 ) {
360
+ if ( this . stream ) {
361
+ this . stream . removeAllListeners ( 'data' ) ;
362
+ }
363
+ while ( this . commandQueue . length > 0 ) {
364
+ item = this . commandQueue . shift ( ) ;
365
+ item . command . reject ( error ) ;
366
+ }
365
367
}
366
368
} ;
367
369
You can’t perform that action at this time.
0 commit comments