0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-15 22:42:23 +01:00

Merge branch 'erikj/update_extremeties' into hotfixes-v0.10.0-r2

This commit is contained in:
Erik Johnston 2015-09-16 09:54:42 +01:00
commit 663b96ae96
2 changed files with 11 additions and 0 deletions

View file

@ -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 = {} events_by_room = {}
for ev in events: for ev in events:
events_by_room.setdefault(ev.room_id, []).append(ev) events_by_room.setdefault(ev.room_id, []).append(ev)

View file

@ -275,6 +275,8 @@ class EventsStore(SQLBaseStore):
(False, event.event_id,) (False, event.event_id,)
) )
self._update_extremeties(txn, [event])
events_and_contexts = filter( events_and_contexts = filter(
lambda ec: ec[0] not in to_remove, lambda ec: ec[0] not in to_remove,
events_and_contexts events_and_contexts