diff --git a/src/matrix/room/timeline/persistence/GapWriter.js b/src/matrix/room/timeline/persistence/GapWriter.js index 860265f5..ac265f9d 100644 --- a/src/matrix/room/timeline/persistence/GapWriter.js +++ b/src/matrix/room/timeline/persistence/GapWriter.js @@ -105,7 +105,7 @@ export class GapWriter { } } - _storeEvents(events, startKey, direction, state, txn) { + async _storeEvents(events, startKey, direction, state, txn) { const entries = []; const updatedEntries = []; // events is in reverse chronological order for backwards pagination, @@ -123,7 +123,7 @@ export class GapWriter { txn.timelineEvents.insert(eventStorageEntry); const eventEntry = new EventEntry(eventStorageEntry, this._fragmentIdComparer); directionalAppend(entries, eventEntry, direction); - const updatedRelationTargetEntry = this._relationWriter.writeRelation(eventEntry); + const updatedRelationTargetEntry = await this._relationWriter.writeRelation(eventEntry); if (updatedRelationTargetEntry) { updatedEntries.push(updatedRelationTargetEntry); } @@ -246,7 +246,7 @@ export class GapWriter { end = null; } // create entries for all events in chunk, add them to entries - const {entries, updatedEntries} = this._storeEvents(nonOverlappingEvents, lastKey, direction, state, txn); + const {entries, updatedEntries} = await this._storeEvents(nonOverlappingEvents, lastKey, direction, state, txn); const fragments = await this._updateFragments(fragmentEntry, neighbourFragmentEntry, end, entries, txn); return {entries, updatedEntries, fragments};