mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-27 12:08:32 +03:00
Merge pull request #281 from matrix-org/erikj/update_extremeties
When updating a stored event from outlier to non-outlier, remember to update the extremeties
This commit is contained in:
commit
2048388cfd
2 changed files with 11 additions and 0 deletions
|
@ -303,6 +303,15 @@ class EventFederationStore(SQLBaseStore):
|
|||
],
|
||||
)
|
||||
|
||||
self._update_extremeties(txn, events)
|
||||
|
||||
def _update_extremeties(self, txn, events):
|
||||
"""Updates the event_*_extremities tables based on the new/updated
|
||||
events being persisted.
|
||||
|
||||
This is called for new events *and* for events that were outliers, but
|
||||
are are now being persisted as non-outliers.
|
||||
"""
|
||||
events_by_room = {}
|
||||
for ev in events:
|
||||
events_by_room.setdefault(ev.room_id, []).append(ev)
|
||||
|
|
|
@ -281,6 +281,8 @@ class EventsStore(SQLBaseStore):
|
|||
(False, event.event_id,)
|
||||
)
|
||||
|
||||
self._update_extremeties(txn, [event])
|
||||
|
||||
events_and_contexts = filter(
|
||||
lambda ec: ec[0] not in to_remove,
|
||||
events_and_contexts
|
||||
|
|
Loading…
Reference in a new issue