From 94b0bc82efddda3c4ddd50e3313cc9d1579e19d0 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 20 May 2021 11:44:45 +0200 Subject: [PATCH] writing relations is async --- src/matrix/room/timeline/persistence/GapWriter.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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};