no need to call decrypt when there are no events

This commit is contained in:
Bruno Windels 2020-09-03 15:30:54 +02:00
parent 408ff3322d
commit 4401012312

View file

@ -64,6 +64,9 @@ export class DeviceMessageHandler {
} }
const readTxn = await this._storage.readTxn([this._storage.storeNames.session]); const readTxn = await this._storage.readTxn([this._storage.storeNames.session]);
const pendingEvents = await this._getPendingEvents(readTxn); const pendingEvents = await this._getPendingEvents(readTxn);
if (pendingEvents.length === 0) {
return;
}
// 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);