summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-02-01 18:27:24 +0000
committerErik Johnston <erik@matrix.org>2017-02-01 18:27:24 +0000
commitfac3c03087b14abf7b9857f937fd3311e0619a6f (patch)
treef354e273590f8d2738037c2a19b13c9c77bbce44 /synapse
parentMerge pull request #1872 from matrix-org/erikj/key_changes (diff)
downloadsynapse-fac3c03087b14abf7b9857f937fd3311e0619a6f.tar.xz
Be more agressive about purging old room event_push_actions
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/event_push_actions.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/synapse/storage/event_push_actions.py b/synapse/storage/event_push_actions.py
index 7de3e8c58c..522d0114cb 100644
--- a/synapse/storage/event_push_actions.py
+++ b/synapse/storage/event_push_actions.py
@@ -450,8 +450,12 @@ class EventPushActionsStore(SQLBaseStore):
     def _remove_old_push_actions_before_txn(self, txn, room_id, user_id,
                                             topological_ordering):
         """
-        Purges old, stale push actions for a user and room before a given
-        topological_ordering
+        Purges old push actions for a user and room before a given
+        topological_ordering.
+
+        We however keep a months worth of highlighted notifications, so that
+        users can still get a list of recent highlights.
+
         Args:
             txn: The transcation
             room_id: Room ID to delete from
@@ -475,7 +479,8 @@ class EventPushActionsStore(SQLBaseStore):
         txn.execute(
             "DELETE FROM event_push_actions "
             " WHERE user_id = ? AND room_id = ? AND "
-            " topological_ordering < ? AND stream_ordering < ?",
+            " topological_ordering < ?"
+            " AND ((stream_ordering < ? AND highlight = 1) or highlight = 0)",
             (user_id, room_id, topological_ordering, self.stream_ordering_month_ago)
         )