Fix session transaction issue
This commit is contained in:
parent
87c9151d70
commit
fcaa34d67a
2 changed files with 12 additions and 2 deletions
|
@ -820,7 +820,7 @@ export class SignalProtocolStore extends EventsMixin {
|
||||||
encodedAddresses: Array<string>,
|
encodedAddresses: Array<string>,
|
||||||
{ zone = GLOBAL_ZONE }: SessionTransactionOptions = {}
|
{ zone = GLOBAL_ZONE }: SessionTransactionOptions = {}
|
||||||
): Promise<Array<SessionRecord>> {
|
): Promise<Array<SessionRecord>> {
|
||||||
return this.withZone(zone, 'loadSession', async () => {
|
return this.withZone(zone, 'loadSessions', async () => {
|
||||||
const sessions = await Promise.all(
|
const sessions = await Promise.all(
|
||||||
encodedAddresses.map(async address =>
|
encodedAddresses.map(async address =>
|
||||||
this.loadSession(address, { zone })
|
this.loadSession(address, { zone })
|
||||||
|
@ -1100,7 +1100,7 @@ export class SignalProtocolStore extends EventsMixin {
|
||||||
|
|
||||||
item.archiveCurrentState();
|
item.archiveCurrentState();
|
||||||
|
|
||||||
await this.storeSession(entry.fromDB.id, item);
|
await this.storeSession(entry.fromDB.id, item, { zone });
|
||||||
},
|
},
|
||||||
zone
|
zone
|
||||||
);
|
);
|
||||||
|
|
|
@ -1477,6 +1477,16 @@ describe('SignalProtocolStore', () => {
|
||||||
|
|
||||||
assert.deepEqual(order, [1, 2, 3]);
|
assert.deepEqual(order, [1, 2, 3]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not deadlock in archiveSiblingSessions', async () => {
|
||||||
|
const id = `${number}.1`;
|
||||||
|
const sibling = `${number}.2`;
|
||||||
|
|
||||||
|
await store.storeSession(id, getSessionRecord(true));
|
||||||
|
await store.storeSession(sibling, getSessionRecord(true));
|
||||||
|
|
||||||
|
await store.archiveSiblingSessions(id, { zone });
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Not yet processed messages', () => {
|
describe('Not yet processed messages', () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue