summary refs log tree commit diff
path: root/synapse/storage/roommember.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/roommember.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/roommember.py')
-rw-r--r--synapse/storage/roommember.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py
index 09fb77a194..117da817ba 100644
--- a/synapse/storage/roommember.py
+++ b/synapse/storage/roommember.py
@@ -35,7 +35,7 @@ RoomsForUser = namedtuple(
 
 class RoomMemberStore(SQLBaseStore):
 
-    def _store_room_member_txn(self, txn, event):
+    def _store_room_member_txn(self, txn, invalidates, event):
         """Store a room member in the database.
         """
         try:
@@ -64,8 +64,10 @@ class RoomMemberStore(SQLBaseStore):
             }
         )
 
-        self.get_rooms_for_user.invalidate(target_user_id)
-        self.get_joined_hosts_for_room.invalidate(event.room_id)
+        invalidates.extend([
+            (self.get_rooms_for_user.invalidate, target_user_id),
+            (self.get_joined_hosts_for_room.invalidate, event.room_id),
+        ])
 
     def get_room_member(self, user_id, room_id):
         """Retrieve the current state of a room member.