From 03c8df54f068ebb44df1c34309249169d9e326b8 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Thu, 14 Apr 2016 17:25:27 +0100 Subject: Invalidate the receipt cache correctly --- synapse/replication/slave/storage/event_push_actions.py | 4 ++-- synapse/replication/slave/storage/receipts.py | 10 ++++------ 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)) -- cgit 1.4.1