forgot to await

This commit is contained in:
Bruno Windels 2020-09-02 14:52:02 +02:00
parent e09fbf566d
commit 1f66868566

View File

@ -34,7 +34,7 @@ export class DeviceMessageHandler {
async writeSync(toDeviceEvents, txn) { async writeSync(toDeviceEvents, txn) {
const encryptedEvents = toDeviceEvents.filter(e => e.type === "m.room.encrypted"); const encryptedEvents = toDeviceEvents.filter(e => e.type === "m.room.encrypted");
// store encryptedEvents // store encryptedEvents
let pendingEvents = this._getPendingEvents(txn); let pendingEvents = await this._getPendingEvents(txn);
pendingEvents = pendingEvents.concat(encryptedEvents); pendingEvents = pendingEvents.concat(encryptedEvents);
txn.session.set(PENDING_ENCRYPTED_EVENTS, pendingEvents); txn.session.set(PENDING_ENCRYPTED_EVENTS, pendingEvents);
// we don't handle anything other for now // we don't handle anything other for now
@ -63,7 +63,7 @@ export class DeviceMessageHandler {
return; return;
} }
const readTxn = await this._storage.readTxn([this._storage.storeNames.session]); const readTxn = await this._storage.readTxn([this._storage.storeNames.session]);
const pendingEvents = this._getPendingEvents(readTxn); const pendingEvents = await this._getPendingEvents(readTxn);
// only know olm for now // only know olm for now
const olmEvents = pendingEvents.filter(e => e.content?.algorithm === OLM_ALGORITHM); const olmEvents = pendingEvents.filter(e => e.content?.algorithm === OLM_ALGORITHM);
const decryptChanges = await this._olmDecryption.decryptAll(olmEvents); const decryptChanges = await this._olmDecryption.decryptAll(olmEvents);