Skip to content

Commit c96f1ba

Browse files
authored
Merge pull request #2569 from matrix-org/matthew/avoid-sync-overlaps
Don't load the sync accumulator if there's already a sync persist in flight
2 parents 6316a6a + 43c8135 commit c96f1ba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/store/indexeddb-local-backend.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,6 @@ export class LocalIndexedDBStoreBackend implements IIndexedDBBackend {
409409
}
410410

411411
public async syncToDatabase(userTuples: UserTuple[]): Promise<void> {
412-
const syncData = this.syncAccumulator.getJSON(true);
413-
414412
if (this.isPersisting) {
415413
logger.warn("Skipping syncToDatabase() as persist already in flight");
416414
this.pendingUserPresenceData.push(...userTuples);
@@ -421,6 +419,8 @@ export class LocalIndexedDBStoreBackend implements IIndexedDBBackend {
421419
}
422420

423421
try {
422+
const syncData = this.syncAccumulator.getJSON(true);
423+
424424
await Promise.all([
425425
this.persistUserPresenceEvents(userTuples),
426426
this.persistAccountData(syncData.accountData),

0 commit comments

Comments
 (0)