From d8d97c40f7f1104e76fb638bb4c92ac9fe7026e4 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 8 Apr 2021 18:35:30 +0200 Subject: [PATCH 1/4] show start time milliseconds in log viewer --- scripts/logviewer/main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/logviewer/main.js b/scripts/logviewer/main.js index e7574fae..51a5760a 100644 --- a/scripts/logviewer/main.js +++ b/scripts/logviewer/main.js @@ -82,12 +82,13 @@ function showItemDetails(item, parent, itemNode) { const parentOffset = itemStart(parent) ? `${itemStart(item) - itemStart(parent)}ms` : "none"; const expandButton = t.button("Expand recursively"); expandButton.addEventListener("click", () => expandResursively(itemNode.parentElement.parentElement)); + const start = itemStart(item); const aside = t.aside([ t.h3(itemCaption(item)), t.p([t.strong("Log level: "), logLevels[itemLevel(item)]]), t.p([t.strong("Error: "), itemError(item) ? `${itemError(item).name} ${itemError(item).stack}` : "none"]), t.p([t.strong("Parent offset: "), parentOffset]), - t.p([t.strong("Start: "), new Date(itemStart(item)).toString()]), + t.p([t.strong("Start: "), new Date(start).toString(), ` (${start})`]), t.p([t.strong("Duration: "), `${itemDuration(item)}ms`]), t.p([t.strong("Child count: "), itemChildren(item) ? `${itemChildren(item).length}` : "none"]), t.p([t.strong("Forced finish: "), (itemForcedFinish(item) || false) + ""]), From f976eeaf13d0d2c735c501406a6e469f880508d5 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 8 Apr 2021 18:36:09 +0200 Subject: [PATCH 2/4] rename SortedArray.replace to update --- src/matrix/room/timeline/Timeline.js | 4 +++- src/observable/list/SortedArray.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/matrix/room/timeline/Timeline.js b/src/matrix/room/timeline/Timeline.js index 7743ddb8..5c9091df 100644 --- a/src/matrix/room/timeline/Timeline.js +++ b/src/matrix/room/timeline/Timeline.js @@ -76,7 +76,9 @@ export class Timeline { replaceEntries(entries) { for (const entry of entries) { - this._remoteEntries.replace(entry); + // this will use the comparator and thus + // check for equality using the compare method in BaseEntry + this._remoteEntries.update(entry); } } diff --git a/src/observable/list/SortedArray.js b/src/observable/list/SortedArray.js index 6d3e90c6..193661cf 100644 --- a/src/observable/list/SortedArray.js +++ b/src/observable/list/SortedArray.js @@ -41,11 +41,11 @@ export class SortedArray extends BaseObservableList { } } - replace(item) { + update(item, updateParams = null) { const idx = this.indexOf(item); if (idx !== -1) { this._items[idx] = item; - this.emitUpdate(idx, item, null); + this.emitUpdate(idx, item, updateParams); } } From 9e697c6cbe25c59a41f38676299b4f5f60e9ab66 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 8 Apr 2021 18:36:26 +0200 Subject: [PATCH 3/4] don't add the pending event again if removed already, fixes #289 --- src/matrix/room/sending/SendQueue.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/matrix/room/sending/SendQueue.js b/src/matrix/room/sending/SendQueue.js index 2d74d93e..959a3803 100644 --- a/src/matrix/room/sending/SendQueue.js +++ b/src/matrix/room/sending/SendQueue.js @@ -36,7 +36,7 @@ export class SendQueue { const pendingEvent = new PendingEvent({ data, remove: () => this._removeEvent(pendingEvent), - emitUpdate: () => this._pendingEvents.set(pendingEvent), + emitUpdate: () => this._pendingEvents.update(pendingEvent), attachments }); return pendingEvent; From bdc8451c4a085b8f34c077be91fd60be636adebd Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 8 Apr 2021 18:39:52 +0200 Subject: [PATCH 4/4] better logging --- src/matrix/room/sending/SendQueue.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/matrix/room/sending/SendQueue.js b/src/matrix/room/sending/SendQueue.js index 959a3803..4ad5e527 100644 --- a/src/matrix/room/sending/SendQueue.js +++ b/src/matrix/room/sending/SendQueue.js @@ -118,7 +118,7 @@ export class SendQueue { } if (idx !== -1) { const pendingEvent = this._pendingEvents.get(idx); - parentLog.log({l: "removeRemoteEcho", id: pendingEvent.remoteId}); + parentLog.log({l: "removeRemoteEcho", queueIndex: pendingEvent.queueIndex, remoteId: event.event_id, txnId}); txn.pendingEvents.remove(pendingEvent.roomId, pendingEvent.queueIndex); removed.push(pendingEvent); }