@@ -407,19 +407,6 @@ class Connection extends EventEmitter {
407
407
this . _paused_packets . push ( packet ) ;
408
408
return ;
409
409
}
410
- if ( packet ) {
411
- if ( this . sequenceId !== packet . sequenceId ) {
412
- const err = new Error (
413
- `Warning: got packets out of order. Expected ${ this . sequenceId } but received ${ packet . sequenceId } `
414
- ) ;
415
- err . expected = this . sequenceId ;
416
- err . received = packet . sequenceId ;
417
- this . emit ( 'warn' , err ) ; // REVIEW
418
- // eslint-disable-next-line no-console
419
- console . error ( err . message ) ;
420
- }
421
- this . _bumpSequenceId ( packet . numPackets ) ;
422
- }
423
410
if ( this . config . debug ) {
424
411
if ( packet ) {
425
412
// eslint-disable-next-line no-console
@@ -458,6 +445,20 @@ class Connection extends EventEmitter {
458
445
this . close ( ) ;
459
446
return ;
460
447
}
448
+ if ( packet ) {
449
+ // Note: when server closes connection due to inactivity, Err packet ER_CLIENT_INTERACTION_TIMEOUT from MySQL 8.0.24, sequenceId will be 0
450
+ if ( this . sequenceId !== packet . sequenceId ) {
451
+ const err = new Error (
452
+ `Warning: got packets out of order. Expected ${ this . sequenceId } but received ${ packet . sequenceId } `
453
+ ) ;
454
+ err . expected = this . sequenceId ;
455
+ err . received = packet . sequenceId ;
456
+ this . emit ( 'warn' , err ) ; // REVIEW
457
+ // eslint-disable-next-line no-console
458
+ console . error ( err . message ) ;
459
+ }
460
+ this . _bumpSequenceId ( packet . numPackets ) ;
461
+ }
461
462
const done = this . _command . execute ( packet , this ) ;
462
463
if ( done ) {
463
464
this . _command = this . _commands . shift ( ) ;
0 commit comments