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

Avoid attempting to delete push actions for remote users. #12879

Merged
merged 3 commits into from
May 26, 2022
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions changelog.d/12879.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Avoid running queries which will never result in deletions.
2 changes: 1 addition & 1 deletion synapse/federation/sender/per_destination_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def mark_new_data(self) -> None:
"""Marks that the destination has new data to send, without starting a
new transaction.

If a transaction loop is already in progress then a new transcation will
If a transaction loop is already in progress then a new transaction will
be attempted when the current one finishes.
"""

Expand Down
2 changes: 1 addition & 1 deletion synapse/storage/databases/main/event_push_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ def _remove_old_push_actions_before_txn(
users can still get a list of recent highlights.

Args:
txn: The transcation
txn: The transaction
room_id: Room ID to delete from
user_id: user ID to delete for
stream_ordering: The lowest stream ordering which will
Expand Down
5 changes: 4 additions & 1 deletion synapse/storage/databases/main/receipts.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,8 +673,11 @@ def insert_linearized_receipt_txn(
lock=False,
)

# When updating a local users read receipt, remove any push actions
# which resulted from the receipt's event and all earlier events.
if (
receipt_type in (ReceiptTypes.READ, ReceiptTypes.READ_PRIVATE)
self.hs.is_mine_id(user_id)
and receipt_type in (ReceiptTypes.READ, ReceiptTypes.READ_PRIVATE)
and stream_ordering is not None
):
self._remove_old_push_actions_before_txn( # type: ignore[attr-defined]
Expand Down
2 changes: 1 addition & 1 deletion synapse/storage/persist_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ async def persist_events(
List of events persisted, the current position room stream position.
The list of events persisted may not be the same as those passed in
if they were deduplicated due to an event already existing that
matched the transcation ID; the existing event is returned in such
matched the transaction ID; the existing event is returned in such
a case.
"""
partitioned: Dict[str, List[Tuple[EventBase, EventContext]]] = {}
Expand Down