summary refs log tree commit diff
path: root/synapse/storage/event_federation.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-05-05 14:57:08 +0100
committerMark Haines <mark.haines@matrix.org>2015-05-05 14:57:08 +0100
commita9aea68fd568182185e8d0ae478c56df8ac6be49 (patch)
tree5d20812a8ea5e727bf1d929cfbb1bc3dc9110eb2 /synapse/storage/event_federation.py
parentSequence the modifications to the cache so that selects don't race with inserts (diff)
downloadsynapse-a9aea68fd568182185e8d0ae478c56df8ac6be49.tar.xz
Invalidate the caches from the correct thread
Diffstat (limited to 'synapse/storage/event_federation.py')
-rw-r--r--synapse/storage/event_federation.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse/storage/event_federation.py b/synapse/storage/event_federation.py
index 68f39bd684..3cd3fbdc9b 100644
--- a/synapse/storage/event_federation.py
+++ b/synapse/storage/event_federation.py
@@ -241,7 +241,7 @@ class EventFederationStore(SQLBaseStore):
 
         return int(min_depth) if min_depth is not None else None
 
-    def _update_min_depth_for_room_txn(self, txn, room_id, depth):
+    def _update_min_depth_for_room_txn(self, txn, invalidates, room_id, depth):
         min_depth = self._get_min_depth_interaction(txn, room_id)
 
         do_insert = depth < min_depth if min_depth else True
@@ -256,8 +256,8 @@ class EventFederationStore(SQLBaseStore):
                 },
             )
 
-    def _handle_prev_events(self, txn, outlier, event_id, prev_events,
-                            room_id):
+    def _handle_prev_events(self, txn, invalidates, outlier, event_id,
+                            prev_events, room_id):
         """
         For the given event, update the event edges table and forward and
         backward extremities tables.
@@ -330,7 +330,9 @@ class EventFederationStore(SQLBaseStore):
             )
             txn.execute(query)
 
-            self.get_latest_event_ids_in_room.invalidate(room_id)
+            invalidates.append((
+                self.get_latest_event_ids_in_room.invalidate, room_id
+            ))
 
     def get_backfill_events(self, room_id, event_list, limit):
         """Get a list of Events for a given topic that occurred before (and