Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1873 from matrix-org/erikj/delete_push_actions
Browse files Browse the repository at this point in the history
Be more agressive about purging old room event_push_actions
  • Loading branch information
erikjohnston authored Feb 14, 2017
2 parents d7457c7 + fac3c03 commit 795f8e3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions synapse/storage/event_push_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,12 @@ def _remove_push_actions_for_event_id_txn(self, txn, room_id, event_id):
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
Expand All @@ -475,7 +479,8 @@ def _remove_old_push_actions_before_txn(self, txn, room_id, user_id,
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)
)

Expand Down

0 comments on commit 795f8e3

Please sign in to comment.