Skip to content

Commit 5d9a284

Browse files
Copilotjirimoravcik
andcommitted
Fix linting issues - add parens to arrow functions and remove trailing whitespace
Co-authored-by: jirimoravcik <951187+jirimoravcik@users.noreply.github.com>
1 parent f827f33 commit 5d9a284

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

packages/core/src/session_pool/consts.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export const MAX_POOL_SIZE = 1000;
44

55
/**
66
* Strategies for selecting sessions from the session pool.
7-
*
7+
*
88
* - `RANDOM` - Picks a random session from the pool (default behavior, same as before)
99
* - `ROUND_ROBIN` - Sequentially rotates through sessions in order
1010
* - `USE_UNTIL_FAILURE` - Keeps using the same session until it fails or becomes unusable
@@ -15,17 +15,17 @@ export enum SessionPoolReuseStrategy {
1515
* Picks a random session from the pool. This is the default strategy.
1616
*/
1717
RANDOM = 'RANDOM',
18-
18+
1919
/**
2020
* Sequentially rotates through sessions in order, distributing usage evenly across all sessions.
2121
*/
2222
ROUND_ROBIN = 'ROUND_ROBIN',
23-
23+
2424
/**
2525
* Keeps using the same session until it fails or becomes unusable, maximizing reuse of working sessions.
2626
*/
2727
USE_UNTIL_FAILURE = 'USE_UNTIL_FAILURE',
28-
28+
2929
/**
3030
* Uses the session that hasn't been used for the longest time, helping to keep sessions fresh.
3131
*/

packages/core/src/session_pool/session_pool.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)