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

Add some docstrings (and avoid a duplicate query) in push actions processing #13455

Merged
merged 11 commits into from
Aug 4, 2022
Next Next commit
Add docstrings.
  • Loading branch information
clokep committed Aug 4, 2022
commit cd47343e9e01c21307f3d28b86ab35e6addb076f
15 changes: 13 additions & 2 deletions synapse/storage/databases/main/event_push_actions.py
Original file line number Diff line number Diff line change
@@ -956,10 +956,12 @@ def _handle_new_receipts_for_notifs_txn(self, txn: LoggingTransaction) -> bool:
return len(rows) < limit

def _rotate_notifs_txn(self, txn: LoggingTransaction) -> bool:
"""Archives older notifications into event_push_summary. Returns whether
the archiving process has caught up or not.
"""Archives older notifications (from event_push_actions) into event_push_summary.

Returns whether the archiving process has caught up or not.
"""

# The (inclusive) event stream ordering that was previously summarized.
old_rotate_stream_ordering = self.db_pool.simple_select_one_onecol_txn(
txn,
table="event_push_summary_stream_ordering",
@@ -1000,6 +1002,15 @@ def _rotate_notifs_txn(self, txn: LoggingTransaction) -> bool:
def _rotate_notifs_before_txn(
self, txn: LoggingTransaction, rotate_to_stream_ordering: int
) -> None:
"""Archives older notifications (from event_push_actions) into event_push_summary.

Args:
txn: The database transaction.
rotate_to_stream_ordering: The new maximum event stream ordering to summarise.

Returns whether the archiving process has caught up or not.
"""

old_rotate_stream_ordering = self.db_pool.simple_select_one_onecol_txn(
txn,
table="event_push_summary_stream_ordering",