summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2016-06-01 11:45:43 +0100
committerDavid Baker <dave@matrix.org>2016-06-01 11:45:43 +0100
commitd60eed07109f61ebe2120e1eb566e5bb7095fbad (patch)
tree7f95d836f9228e779008c3addded2ae3a1b68fd3 /synapse
parenthandle emotes & notices correctly in email notifs (diff)
downloadsynapse-d60eed07109f61ebe2120e1eb566e5bb7095fbad.tar.xz
Limit number of notifications in an email notification
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/event_push_actions.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/storage/event_push_actions.py b/synapse/storage/event_push_actions.py
index 4dae51a172..940e11d7a2 100644
--- a/synapse/storage/event_push_actions.py
+++ b/synapse/storage/event_push_actions.py
@@ -119,7 +119,8 @@ class EventPushActionsStore(SQLBaseStore):
     @defer.inlineCallbacks
     def get_unread_push_actions_for_user_in_range(self, user_id,
                                                   min_stream_ordering,
-                                                  max_stream_ordering=None):
+                                                  max_stream_ordering=None,
+                                                  limit=20):
         def get_after_receipt(txn):
             sql = (
                 "SELECT ep.event_id, ep.room_id, ep.stream_ordering, ep.actions, "
@@ -151,7 +152,8 @@ class EventPushActionsStore(SQLBaseStore):
             if max_stream_ordering is not None:
                 sql += " AND ep.stream_ordering <= ?"
                 args.append(max_stream_ordering)
-            sql += " ORDER BY ep.stream_ordering ASC"
+            sql += " ORDER BY ep.stream_ordering ASC LIMIT ?"
+            args.append(limit)
             txn.execute(sql, args)
             return txn.fetchall()
         after_read_receipt = yield self.runInteraction(