mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 19:45:05 +01:00
writing relations is async
This commit is contained in:
parent
814e92ad92
commit
94b0bc82ef
@ -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};
|
||||
|
Loading…
Reference in New Issue
Block a user