summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-02-09 14:11:47 +0000
committerErik Johnston <erik@matrix.org>2016-02-09 14:11:47 +0000
commit7e3b586c1eac588b23bc2842079978a418ddd95c (patch)
tree959d834a1f7abf447edba2528615e8088454ab84 /synapse/storage
parentFix unit tests (diff)
parentDon't load all ephemeral state for a room on every sync (diff)
downloadsynapse-7e3b586c1eac588b23bc2842079978a418ddd95c.tar.xz
Merge pull request #567 from matrix-org/erikj/sync_ephemeral
Don't load all ephemeral state for a room on every sync
Diffstat (limited to '')
-rw-r--r--synapse/storage/receipts.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/storage/receipts.py b/synapse/storage/receipts.py
index 8068c73740..1aff9f070e 100644
--- a/synapse/storage/receipts.py
+++ b/synapse/storage/receipts.py
@@ -46,6 +46,20 @@ class ReceiptsStore(SQLBaseStore):
             desc="get_receipts_for_room",
         )
 
+    @cached(num_args=3)
+    def get_last_receipt_event_id_for_user(self, user_id, room_id, receipt_type):
+        return self._simple_select_one_onecol(
+            table="receipts_linearized",
+            keyvalues={
+                "room_id": room_id,
+                "receipt_type": receipt_type,
+                "user_id": user_id
+            },
+            retcol="event_id",
+            desc="get_own_receipt_for_user",
+            allow_none=True,
+        )
+
     @cachedInlineCallbacks(num_args=2)
     def get_receipts_for_user(self, user_id, receipt_type):
         def f(txn):