fix(session-pool): round-robin fingerprints in SessionFactory

createSession() used rotator.random() despite its docstring saying 'next
available fingerprint'. Random draws collide in a small profile pool,
producing duplicate fingerprints (and duplicate sess-<fp>-<ms> ids) across
a warm pool — flaky tests and look-alike sessions. Switch to rotator.next()
so each pooled session gets a distinct fingerprint, as documented.
This commit is contained in:
diegosouzapw
2026-05-31 00:47:47 -03:00
parent a365706d65
commit d22564df4d

View File

@@ -25,7 +25,10 @@ export class SessionFactory {
* would involve Playwright browser automation.
*/
createSession(): Session {
const fingerprint = this.rotator.random();
// Round-robin so each session in a warm pool gets a distinct fingerprint
// (a pool of look-alike sessions defeats the purpose). The rotator still
// exposes random() for callers that want unpredictability over time.
const fingerprint = this.rotator.next();
return new Session(
fingerprint,
this.config.cooldownBase,