more logging in sync write

This commit is contained in:
Bruno Windels 2021-03-02 21:29:32 +01:00
parent 8d7cb2a39a
commit 9702c4fd64
2 changed files with 18 additions and 0 deletions

View File

@ -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;

View File

@ -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;