also look for remote echos based on event_id

This commit is contained in:
Bruno Windels 2020-03-23 23:00:33 +01:00
parent f02641c808
commit 8354c58c07

View File

@ -64,15 +64,18 @@ export default class SendQueue {
const removed = []; const removed = [];
for (const event of events) { for (const event of events) {
const txnId = event.unsigned && event.unsigned.transaction_id; const txnId = event.unsigned && event.unsigned.transaction_id;
let idx;
if (txnId) { if (txnId) {
const idx = this._pendingEvents.array.findIndex(pe => pe.txnId === txnId); idx = this._pendingEvents.array.findIndex(pe => pe.txnId === txnId);
} else {
idx = this._pendingEvents.array.findIndex(pe => pe.remoteId === event.event_id);
}
if (idx !== -1) { if (idx !== -1) {
const pendingEvent = this._pendingEvents.get(idx); const pendingEvent = this._pendingEvents.get(idx);
txn.pendingEvents.remove(pendingEvent.roomId, pendingEvent.queueIndex); txn.pendingEvents.remove(pendingEvent.roomId, pendingEvent.queueIndex);
removed.push(pendingEvent); removed.push(pendingEvent);
} }
} }
}
return removed; return removed;
} }