fix: Disable EventEmitter maxListeners warning for SSE subscriptions

Each SSE client registers a listener per event type (30+ types), so a
few concurrent connections easily exceed the previous limit of 100.
Listeners are properly cleaned up on disconnect via eventBusIterable's
finally block, so this is not a real leak.
This commit is contained in:
Lukas May
2026-03-06 16:39:36 +01:00
parent 85f5f77927
commit 02ca1d568e
2 changed files with 4 additions and 3 deletions

View File

@@ -22,8 +22,9 @@ export class EventEmitterBus implements EventBus {
constructor() { constructor() {
this.emitter = new EventEmitter(); this.emitter = new EventEmitter();
// Allow more listeners for complex systems // SSE subscriptions register per-event-type listeners (30+ types × N clients).
this.emitter.setMaxListeners(100); // Listeners are properly cleaned up on disconnect, so disable the warning.
this.emitter.setMaxListeners(0);
} }
/** /**

View File

@@ -205,7 +205,7 @@ export async function createRealProviderHarness(
const accountRepository = new DrizzleAccountRepository(db); const accountRepository = new DrizzleAccountRepository(db);
const initiativeRepository = new DrizzleInitiativeRepository(db); const initiativeRepository = new DrizzleInitiativeRepository(db);
// Create event bus with capture (parent class already sets maxListeners to 100) // Create event bus with capture (parent class disables maxListeners warning)
const eventBus = new CapturingEventBus(); const eventBus = new CapturingEventBus();
// Create REAL agent manager (not mock!) // Create REAL agent manager (not mock!)