diff --git a/src/matrix/room/Room.js b/src/matrix/room/Room.js index 0f4d80ab..392ef264 100644 --- a/src/matrix/room/Room.js +++ b/src/matrix/room/Room.js @@ -219,6 +219,8 @@ export class Room extends EventEmitter { await log.wrap("syncWriter", log => this._syncWriter.writeSync(roomResponse, txn, log), log.level.Detail); if (decryptChanges) { const decryption = await decryptChanges.write(txn); + log.set("decryptionResults", decryption.results.size); + log.set("decryptionErrors", decryption.errors.size); if (this._isTimelineOpen) { await decryption.verifySenders(txn); } @@ -229,6 +231,7 @@ export class Room extends EventEmitter { } decryption.applyToEntries(entries); } + log.set("entries", entries.length); let shouldFlushKeyShares = false; // pass member changes to device tracker if (roomEncryption && this.isTrackingMembers && memberChanges?.size) { @@ -240,6 +243,9 @@ export class Room extends EventEmitter { entries, isInitialSync, !this._isTimelineOpen, this._user.id); // write summary changes, and unset if nothing was actually changed summaryChanges = this._summary.writeData(summaryChanges, txn); + if (summaryChanges) { + log.set("summaryChanges", summaryChanges.diff(this._summary.data)); + } // fetch new members while we have txn open, // but don't make any in-memory changes yet let heroChanges; diff --git a/src/matrix/room/RoomSummary.js b/src/matrix/room/RoomSummary.js index 2f1e7703..8c7c8576 100644 --- a/src/matrix/room/RoomSummary.js +++ b/src/matrix/room/RoomSummary.js @@ -169,6 +169,18 @@ class SummaryData { this.cloned = copy ? true : false; } + diff(other) { + const props = Object.getOwnPropertyNames(this); + return props.reduce((diff, prop) => { + if (prop !== "cloned") { + if (this[prop] !== other[prop]) { + diff[prop] = this[prop]; + } + } + return diff; + }, {}); + } + cloneIfNeeded() { if (this.cloned) { return this;