Skip to content

Commit

Permalink
don't load the sync accumulator if there's already a sync persist in …
Browse files Browse the repository at this point in the history
…flight

this should hopefully reduce chances of
https://github.com/vector-im/element-web/issues/21541 a bit more
as we were incorrectly loading the sync accumulator even
if a sync persist was already in flight, thus wasting RAM
and increasing the chance of the renderer process OOMing
  • Loading branch information
ara4n committed Aug 7, 2022
1 parent 6316a6a commit 43c8135
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/store/indexeddb-local-backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,6 @@ export class LocalIndexedDBStoreBackend implements IIndexedDBBackend {
}

public async syncToDatabase(userTuples: UserTuple[]): Promise<void> {
const syncData = this.syncAccumulator.getJSON(true);

if (this.isPersisting) {
logger.warn("Skipping syncToDatabase() as persist already in flight");
this.pendingUserPresenceData.push(...userTuples);
Expand All @@ -421,6 +419,8 @@ export class LocalIndexedDBStoreBackend implements IIndexedDBBackend {
}

try {
const syncData = this.syncAccumulator.getJSON(true);

await Promise.all([
this.persistUserPresenceEvents(userTuples),
this.persistAccountData(syncData.accountData),
Expand Down

0 comments on commit 43c8135

Please sign in to comment.