diff --git a/ts/SignalProtocolStore.ts b/ts/SignalProtocolStore.ts index 79b176bda5..6ffbbe8c50 100644 --- a/ts/SignalProtocolStore.ts +++ b/ts/SignalProtocolStore.ts @@ -820,7 +820,7 @@ export class SignalProtocolStore extends EventsMixin { encodedAddresses: Array, { zone = GLOBAL_ZONE }: SessionTransactionOptions = {} ): Promise> { - return this.withZone(zone, 'loadSession', async () => { + return this.withZone(zone, 'loadSessions', async () => { const sessions = await Promise.all( encodedAddresses.map(async address => this.loadSession(address, { zone }) @@ -1100,7 +1100,7 @@ export class SignalProtocolStore extends EventsMixin { item.archiveCurrentState(); - await this.storeSession(entry.fromDB.id, item); + await this.storeSession(entry.fromDB.id, item, { zone }); }, zone ); diff --git a/ts/test-electron/SignalProtocolStore_test.ts b/ts/test-electron/SignalProtocolStore_test.ts index 6c0a6eb22f..c884bdeeca 100644 --- a/ts/test-electron/SignalProtocolStore_test.ts +++ b/ts/test-electron/SignalProtocolStore_test.ts @@ -1477,6 +1477,16 @@ describe('SignalProtocolStore', () => { 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', () => {