Skip to content

Commit

Permalink
add more logging to backup storage migration
Browse files Browse the repository at this point in the history
  • Loading branch information
bwindels committed Feb 1, 2022
1 parent c6820ec commit b29ecd3
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/matrix/storage/idb/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,23 @@ async function clearAllStores(db: IDBDatabase, txn: IDBTransaction) {
// v15 add backup index to inboundGroupSessions
async function addInboundSessionBackupIndex(db: IDBDatabase, txn: IDBTransaction, localStorage: IDOMStorage, log: ILogItem): Promise<void> {
const inboundGroupSessions = txn.objectStore("inboundGroupSessions");
let countWithSession = 0;
let countWithoutSession = 0;
await iterateCursor<InboundGroupSessionEntry>(inboundGroupSessions.openCursor(), (value, key, cursor) => {
value.backup = BackupStatus.NotBackedUp;
// we'll also have backup keys in here, we can't tell,
// but the worst thing that can happen is that we try
// to backup keys that were already in backup, which
// the server will ignore
value.source = KeySource.DeviceMessage;
if (value.session) {
value.backup = BackupStatus.NotBackedUp;
// we'll also have backup keys in here, we can't tell,
// but the worst thing that can happen is that we try
// to backup keys that were already in backup, which
// the server will ignore
value.source = KeySource.DeviceMessage;
countWithSession += 1;
} else {
countWithoutSession += 1;
}
return NOT_DONE;
});
log.set("countWithoutSession", countWithoutSession);
log.set("countWithSession", countWithSession);
inboundGroupSessions.createIndex("byBackup", "backup", {unique: false});
}

0 comments on commit b29ecd3

Please sign in to comment.