Use calculated topological ordering when persisting events
This commit is contained in:
parent
6188512b18
commit
bf599cdba1
|
@ -1020,7 +1020,7 @@ class EventsStore(EventsWorkerStore):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
chunk_id, _ = self._insert_into_chunk_txn(
|
chunk_id, topo = self._insert_into_chunk_txn(
|
||||||
txn, event.room_id, event.event_id,
|
txn, event.room_id, event.event_id,
|
||||||
[eid for eid, _ in event.prev_events],
|
[eid for eid, _ in event.prev_events],
|
||||||
)
|
)
|
||||||
|
@ -1032,6 +1032,7 @@ class EventsStore(EventsWorkerStore):
|
||||||
updatevalues={
|
updatevalues={
|
||||||
"outlier": False,
|
"outlier": False,
|
||||||
"chunk_id": chunk_id,
|
"chunk_id": chunk_id,
|
||||||
|
"topological_ordering": topo,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1117,9 +1118,9 @@ class EventsStore(EventsWorkerStore):
|
||||||
|
|
||||||
for event, _ in events_and_contexts:
|
for event, _ in events_and_contexts:
|
||||||
if event.internal_metadata.is_outlier():
|
if event.internal_metadata.is_outlier():
|
||||||
chunk_id, _topo = None, 0
|
chunk_id, topo = None, 0
|
||||||
else:
|
else:
|
||||||
chunk_id, _topo = self._insert_into_chunk_txn(
|
chunk_id, topo = self._insert_into_chunk_txn(
|
||||||
txn, event.room_id, event.event_id,
|
txn, event.room_id, event.event_id,
|
||||||
[eid for eid, _ in event.prev_events],
|
[eid for eid, _ in event.prev_events],
|
||||||
)
|
)
|
||||||
|
@ -1130,7 +1131,7 @@ class EventsStore(EventsWorkerStore):
|
||||||
values={
|
values={
|
||||||
"stream_ordering": event.internal_metadata.stream_ordering,
|
"stream_ordering": event.internal_metadata.stream_ordering,
|
||||||
"chunk_id": chunk_id,
|
"chunk_id": chunk_id,
|
||||||
"topological_ordering": event.depth,
|
"topological_ordering": topo,
|
||||||
"depth": event.depth,
|
"depth": event.depth,
|
||||||
"event_id": event.event_id,
|
"event_id": event.event_id,
|
||||||
"room_id": event.room_id,
|
"room_id": event.room_id,
|
||||||
|
|
Loading…
Reference in New Issue