summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-02-07 17:40:29 +0000
committerRichard van der Hoff <richard@matrix.org>2018-02-09 13:07:41 +0000
commite571aef06d3b1af3946e790841f4b8a3a4cfdebf (patch)
treef4077527cd28b56fafaa0761bcd344d7dfa66412
parentbump purge logging to info (diff)
downloadsynapse-e571aef06d3b1af3946e790841f4b8a3a4cfdebf.tar.xz
purge: Move cache invalidation to more appropriate place
it was a bit of a non-sequitur there
-rw-r--r--synapse/storage/events.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index 803a4e2477..24d9978304 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -2099,9 +2099,6 @@ class EventsStore(SQLBaseStore):
             "[purge] found %i events before cutoff, of which %i are remote"
             " 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")
 
         # We calculate the new entries for the backward extremeties by finding
@@ -2229,12 +2226,15 @@ class EventsStore(SQLBaseStore):
             state_rows
         )
 
-        # Delete all non-state
         logger.info("[purge] removing events from event_to_state_groups")
         txn.executemany(
             "DELETE FROM event_to_state_groups WHERE event_id = ?",
             [(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")
         txn.execute(