Fix session transactions for archive sessions
This commit is contained in:
parent
6323dd6492
commit
b878cad625
1 changed files with 16 additions and 12 deletions
|
@ -972,24 +972,28 @@ export class SignalProtocolStore extends EventsMixin {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _archiveSession(entry?: SessionCacheEntry) {
|
private async _archiveSession(entry?: SessionCacheEntry, zone?: Zone) {
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.enqueueSessionJob(entry.fromDB.id, async () => {
|
await this.enqueueSessionJob(
|
||||||
const item = entry.hydrated
|
entry.fromDB.id,
|
||||||
? entry.item
|
async () => {
|
||||||
: await this._maybeMigrateSession(entry.fromDB);
|
const item = entry.hydrated
|
||||||
|
? entry.item
|
||||||
|
: await this._maybeMigrateSession(entry.fromDB);
|
||||||
|
|
||||||
if (!item.hasCurrentState()) {
|
if (!item.hasCurrentState()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
item.archiveCurrentState();
|
item.archiveCurrentState();
|
||||||
|
|
||||||
await this.storeSession(entry.fromDB.id, item);
|
await this.storeSession(entry.fromDB.id, item);
|
||||||
});
|
},
|
||||||
|
zone
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async archiveSession(encodedAddress: string): Promise<void> {
|
async archiveSession(encodedAddress: string): Promise<void> {
|
||||||
|
@ -1037,7 +1041,7 @@ export class SignalProtocolStore extends EventsMixin {
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
entries.map(async entry => {
|
entries.map(async entry => {
|
||||||
await this._archiveSession(entry);
|
await this._archiveSession(entry, zone);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue