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

This commit is contained in:
pengx17
2025-01-20 16:23:00 +00:00
committed by Peng Xiao
parent 22cddb1b87
commit 720a596559
2 changed files with 8 additions and 2 deletions
@@ -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();
});
});
}
@@ -348,6 +348,8 @@ class CloudWorkspaceFlavourProvider implements WorkspaceFlavourProvider {
await storage.connection.waitForConnected();
const localBlob = await storage.get(blob);
storage.connection.disconnect();
if (localBlob) {
return new Blob([localBlob.data], { type: localBlob.mime });
}