purge: Move cache invalidation to more appropriate place

it was a bit of a non-sequitur there
This commit is contained in:
Richard van der Hoff 2018-02-07 17:40:29 +00:00
parent 61ffaa8137
commit e571aef06d

View File

@ -2099,9 +2099,6 @@ class EventsStore(SQLBaseStore):
"[purge] found %i events before cutoff, of which %i are remote" "[purge] found %i events before cutoff, of which %i are remote"
" non-state events to delete", len(event_rows), len(to_delete)) " non-state events to delete", len(event_rows), len(to_delete))
for event_id, state_key in event_rows:
txn.call_after(self._get_state_group_for_event.invalidate, (event_id,))
logger.info("[purge] Finding new backward extremities") logger.info("[purge] Finding new backward extremities")
# We calculate the new entries for the backward extremeties by finding # We calculate the new entries for the backward extremeties by finding
@ -2229,12 +2226,15 @@ class EventsStore(SQLBaseStore):
state_rows state_rows
) )
# Delete all non-state
logger.info("[purge] removing events from event_to_state_groups") logger.info("[purge] removing events from event_to_state_groups")
txn.executemany( txn.executemany(
"DELETE FROM event_to_state_groups WHERE event_id = ?", "DELETE FROM event_to_state_groups WHERE event_id = ?",
[(event_id,) for event_id, _ in event_rows] [(event_id,) for event_id, _ in event_rows]
) )
for event_id, _ in event_rows:
txn.call_after(self._get_state_group_for_event.invalidate, (
event_id,
))
logger.info("[purge] updating room_depth") logger.info("[purge] updating room_depth")
txn.execute( txn.execute(