mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-19 02:56:23 +08:00
fix(infra): increase eventemitter listener count (#9799)
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user