forked from mystiq/hydrogen-web
add more logging to backup storage migration
This commit is contained in:
parent
c6820eccab
commit
b29ecd339d
1 changed files with 15 additions and 6 deletions
|
@ -281,14 +281,23 @@ async function clearAllStores(db: IDBDatabase, txn: IDBTransaction) {
|
||||||
// v15 add backup index to inboundGroupSessions
|
// v15 add backup index to inboundGroupSessions
|
||||||
async function addInboundSessionBackupIndex(db: IDBDatabase, txn: IDBTransaction, localStorage: IDOMStorage, log: ILogItem): Promise<void> {
|
async function addInboundSessionBackupIndex(db: IDBDatabase, txn: IDBTransaction, localStorage: IDOMStorage, log: ILogItem): Promise<void> {
|
||||||
const inboundGroupSessions = txn.objectStore("inboundGroupSessions");
|
const inboundGroupSessions = txn.objectStore("inboundGroupSessions");
|
||||||
|
let countWithSession = 0;
|
||||||
|
let countWithoutSession = 0;
|
||||||
await iterateCursor<InboundGroupSessionEntry>(inboundGroupSessions.openCursor(), (value, key, cursor) => {
|
await iterateCursor<InboundGroupSessionEntry>(inboundGroupSessions.openCursor(), (value, key, cursor) => {
|
||||||
|
if (value.session) {
|
||||||
value.backup = BackupStatus.NotBackedUp;
|
value.backup = BackupStatus.NotBackedUp;
|
||||||
// we'll also have backup keys in here, we can't tell,
|
// we'll also have backup keys in here, we can't tell,
|
||||||
// but the worst thing that can happen is that we try
|
// but the worst thing that can happen is that we try
|
||||||
// to backup keys that were already in backup, which
|
// to backup keys that were already in backup, which
|
||||||
// the server will ignore
|
// the server will ignore
|
||||||
value.source = KeySource.DeviceMessage;
|
value.source = KeySource.DeviceMessage;
|
||||||
|
countWithSession += 1;
|
||||||
|
} else {
|
||||||
|
countWithoutSession += 1;
|
||||||
|
}
|
||||||
return NOT_DONE;
|
return NOT_DONE;
|
||||||
});
|
});
|
||||||
|
log.set("countWithoutSession", countWithoutSession);
|
||||||
|
log.set("countWithSession", countWithSession);
|
||||||
inboundGroupSessions.createIndex("byBackup", "backup", {unique: false});
|
inboundGroupSessions.createIndex("byBackup", "backup", {unique: false});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue