fix(infra): increase eventemitter listener count (#9799)

This commit is contained in:
pengx17 authored and Peng Xiao committed 2025-01-22 12:15:20 +08:00
1 parent 22cddb1b87
commit 720a596559
2 files changed
+8 -2

No files matched your search

@@ -24,7 +24,9 @@ export interface Connection<T = any> {
export abstract class AutoReconnectConnection<T = any>
implements Connection<T>
{
private readonly event = new EventEmitter2();
private readonly event = new EventEmitter2({
maxListeners: 100,
});
private _inner: T | undefined = undefined;
private _status: ConnectionStatus = 'idle';
private _error: Error | undefined = undefined;
@@ -168,14 +170,16 @@ export abstract class AutoReconnectConnection<T = any>
return;
}
this.onStatusChanged(status => {
const off = this.onStatusChanged(status => {
if (status === 'connected') {
resolve();
off();
}
});
signal?.addEventListener('abort', reason => {
reject(reason);
off();
});
});
}