summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2016-04-14 17:25:27 +0100
committerMark Haines <mark.haines@matrix.org>2016-04-14 17:25:27 +0100
commit03c8df54f068ebb44df1c34309249169d9e326b8 (patch)
tree0f43705407c0902a17dc020ae4c1d48f32850283
parentMerge branch 'develop' into markjh/split_pusher (diff)
downloadsynapse-03c8df54f068ebb44df1c34309249169d9e326b8.tar.xz
Invalidate the receipt cache correctly
-rw-r--r--synapse/replication/slave/storage/event_push_actions.py4
-rw-r--r--synapse/replication/slave/storage/receipts.py10
2 files changed, 6 insertions, 8 deletions
diff --git a/synapse/replication/slave/storage/event_push_actions.py b/synapse/replication/slave/storage/event_push_actions.py
index 26efe6daf6..8774feb94e 100644
--- a/synapse/replication/slave/storage/event_push_actions.py
+++ b/synapse/replication/slave/storage/event_push_actions.py
@@ -42,10 +42,10 @@ class SlavedPushActionsStore(SlavedEventStore, SlavedReceiptsStore):
             event, backfilled, reset_state
         )
 
-    def invalidate_caches_for_receipt(self, user_id, room_id):
+    def invalidate_caches_for_receipt(self, room_id, receipt_type, user_id):
         self.get_unread_event_push_actions_by_room_for_user.invalidate_many(
             (room_id,)
         )
         super(SlavedPushActionsStore, self).invalidate_caches_for_receipt(
-            user_id, room_id
+            room_id, receipt_type, user_id
         )
diff --git a/synapse/replication/slave/storage/receipts.py b/synapse/replication/slave/storage/receipts.py
index fd6b6492dd..b55d5dfd08 100644
--- a/synapse/replication/slave/storage/receipts.py
+++ b/synapse/replication/slave/storage/receipts.py
@@ -52,12 +52,10 @@ class SlavedReceiptsStore(BaseSlavedStore):
         if stream:
             self._receipts_id_gen.advance(stream["position"])
             for row in stream["rows"]:
-                room_id = row[1]
-                user_id = row[3]
-                self.invalidate_caches_for_receipt(user_id, room_id)
-                self.get_receipts_for_user.invalidate((user_id,))
+                room_id, receipt_type, user_id = row[1:4]
+                self.invalidate_caches_for_receipt(room_id, receipt_type, user_id)
 
         return super(SlavedReceiptsStore, self).process_replication(result)
 
-    def invalidate_caches_for_receipt(self, user_id, room_id):
-        self.get_receipts_for_user.invalidate((user_id,))
+    def invalidate_caches_for_receipt(self, room_id, receipt_type, user_id):
+        self.get_receipts_for_user.invalidate((user_id, receipt_type))