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

Be more agressive about purging old room event_push_actions #1873

Merged
merged 1 commit into from
Feb 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capitalise "OR" please.

(user_id, room_id, topological_ordering, self.stream_ordering_month_ago)
)

Expand Down