Wrap room.writeSync and co in an async log wrap to preserve context

This commit is contained in:
Kegan Dougal 2021-12-15 14:11:51 +00:00
parent 21f510e754
commit 131d255180

View file

@ -411,6 +411,7 @@ export class Sync3 {
// session.prepareSync // E2EE decrypts room keys
// this.session.writeSync() // write account data, device lists, etc.
await Promise.all(updates.map(async (roomResponse) => {
await log.wrap("room", async () => {
// get or create a room
let room = this.session.rooms.get(roomResponse.room_id);
if (!room) {
@ -463,6 +464,7 @@ export class Sync3 {
room: room,
changes: changes,
});
})
}))
} catch (err) {
// avoid corrupting state by only