let loadMembers use own txn in case members haven't been fetched yet

if they haven't, it will need a network request, meaning that the txn
will get closed, so we can't reuse it afterwards
This commit is contained in:
Bruno Windels 2022-07-27 11:39:50 +02:00
parent 50b6ee91d7
commit f18520a2fe

View file

@ -116,13 +116,12 @@ export class DeviceTracker {
if (room.isTrackingMembers || !room.isEncrypted) {
return;
}
const memberList = await room.loadMemberList(undefined, log);
const txn = await this._storage.readWriteTxn([
this._storage.storeNames.roomSummary,
this._storage.storeNames.userIdentities,
]);
let memberList;
try {
memberList = await room.loadMemberList(txn, log);
let isTrackingChanges;
try {
isTrackingChanges = room.writeIsTrackingMembers(true, txn);
@ -140,7 +139,7 @@ export class DeviceTracker {
await txn.complete();
room.applyIsTrackingMembersChanges(isTrackingChanges);
} finally {
memberList?.release();
memberList.release();
}
}