summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorMatrix <matrix@matrix.org>2015-07-18 19:07:12 +0100
committerMatrix <matrix@matrix.org>2015-07-18 19:07:12 +0100
commit4cab2cfa34ceb384847d8bd5dbe15147b27dc370 (patch)
tree9d3cb46452a489274530295a24993d863d2a4fa8 /synapse/handlers
parentMerge pull request #199 from matrix-org/erikj/receipts (diff)
downloadsynapse-4cab2cfa34ceb384847d8bd5dbe15147b27dc370.tar.xz
Don't do any database hits in receipt handling if from_key == to_key
Diffstat (limited to '')
-rw-r--r--synapse/handlers/receipts.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/synapse/handlers/receipts.py b/synapse/handlers/receipts.py
index 5b3df6932b..86c911c4bf 100644
--- a/synapse/handlers/receipts.py
+++ b/synapse/handlers/receipts.py
@@ -174,6 +174,9 @@ class ReceiptEventSource(object):
         from_key = int(from_key)
         to_key = yield self.get_current_key()
 
+        if from_key == to_key:
+            defer.returnValue(([], to_key))
+
         rooms = yield self.store.get_rooms_for_user(user.to_string())
         rooms = [room.room_id for room in rooms]
         events = yield self.store.get_linearized_receipts_for_rooms(