@@ -522,14 +522,14 @@ export class SessionPool extends EventEmitter {
522522 if ( this . sessions . length === 0 ) {
523523 throw new Error ( 'SessionPool is empty - cannot pick a session' ) ;
524524 }
525-
526- const usableSessions = this . sessions . filter ( s => s . isUsable ( ) ) ;
525+
526+ const usableSessions = this . sessions . filter ( ( s ) => s . isUsable ( ) ) ;
527527 if ( usableSessions . length === 0 ) {
528528 // Fallback to any session if no usable ones
529529 this . roundRobinIndex = ( this . roundRobinIndex + 1 ) % this . sessions . length ;
530530 return this . sessions [ this . roundRobinIndex ] ;
531531 }
532-
532+
533533 // Find next usable session starting from current index
534534 let attempts = 0 ;
535535 while ( attempts < this . sessions . length ) {
@@ -540,7 +540,7 @@ export class SessionPool extends EventEmitter {
540540 }
541541 attempts ++ ;
542542 }
543-
543+
544544 // Fallback
545545 return this . sessions [ this . roundRobinIndex ] ;
546546 }
@@ -552,18 +552,18 @@ export class SessionPool extends EventEmitter {
552552 if ( this . sessions . length === 0 ) {
553553 throw new Error ( 'SessionPool is empty - cannot pick a session' ) ;
554554 }
555-
555+
556556 if ( this . lastUsedSession && this . lastUsedSession . isUsable ( ) ) {
557557 return this . lastUsedSession ;
558558 }
559-
559+
560560 // Find a new usable session
561- const usableSession = this . sessions . find ( s => s . isUsable ( ) ) ;
561+ const usableSession = this . sessions . find ( ( s ) => s . isUsable ( ) ) ;
562562 if ( usableSession ) {
563563 this . lastUsedSession = usableSession ;
564564 return usableSession ;
565565 }
566-
566+
567567 // Fallback to random if no usable session
568568 const session = this . sessions [ this . _getRandomIndex ( ) ] ;
569569 this . lastUsedSession = session ;
@@ -577,26 +577,26 @@ export class SessionPool extends EventEmitter {
577577 if ( this . sessions . length === 0 ) {
578578 throw new Error ( 'SessionPool is empty - cannot pick a session' ) ;
579579 }
580-
581- const usableSessions = this . sessions . filter ( s => s . isUsable ( ) ) ;
582-
580+
581+ const usableSessions = this . sessions . filter ( ( s ) => s . isUsable ( ) ) ;
582+
583583 if ( usableSessions . length === 0 ) {
584584 // Fallback to random if no usable sessions
585585 return this . sessions [ this . _getRandomIndex ( ) ] ;
586586 }
587-
587+
588588 // Find session with oldest lastUsedAt (or never used)
589589 let lruSession = usableSessions [ 0 ] ;
590590 let oldestTime = lruSession . lastUsedAt ?. getTime ( ) ?? 0 ;
591-
591+
592592 for ( const session of usableSessions ) {
593593 const sessionTime = session . lastUsedAt ?. getTime ( ) ?? 0 ;
594594 if ( sessionTime < oldestTime ) {
595595 oldestTime = sessionTime ;
596596 lruSession = session ;
597597 }
598598 }
599-
599+
600600 return lruSession ;
601601 }
602602
0 commit comments