From b26f7df689295e23b7d7b497a465f354734e7c95 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 29 Jul 2019 09:54:34 +0200 Subject: [PATCH] pending events are not certain to be sorted here --- src/matrix/room/sending/SendQueue.js | 2 +- src/observable/list/SortedArray.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/matrix/room/sending/SendQueue.js b/src/matrix/room/sending/SendQueue.js index b147d0f1..ec7296e8 100644 --- a/src/matrix/room/sending/SendQueue.js +++ b/src/matrix/room/sending/SendQueue.js @@ -18,7 +18,7 @@ export default class SendQueue { if (pendingEvents.length) { console.info(`SendQueue for room ${roomId} has ${pendingEvents.length} pending events`, pendingEvents); } - this._pendingEvents.setManySorted(pendingEvents.map(data => new PendingEvent(data))); + this._pendingEvents.setManyUnsorted(pendingEvents.map(data => new PendingEvent(data))); this._isSending = false; this._offline = false; this._amountSent = 0; diff --git a/src/observable/list/SortedArray.js b/src/observable/list/SortedArray.js index d38f94fd..6b34afdf 100644 --- a/src/observable/list/SortedArray.js +++ b/src/observable/list/SortedArray.js @@ -8,6 +8,10 @@ export default class SortedArray extends BaseObservableList { this._items = []; } + setManyUnsorted(items) { + this.setManySorted(items); + } + setManySorted(items) { // TODO: we can make this way faster by only looking up the first and last key, // and merging whatever is inbetween with items