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

Commit

Permalink
Remove aggregated rows after aggregation process
Browse files Browse the repository at this point in the history
  • Loading branch information
Fizzadar committed Jan 16, 2023
1 parent 47eccd0 commit 90878d6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions synapse/storage/databases/main/beeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,15 @@ def aggregate_txn(txn: LoggingTransaction) -> None:
txn.execute(sql)
orders = list(txn)
if not orders:
logger.info("No user counts aggregated")
return

max_stream_ordering = max(orders)
txn.execute(
"UPDATE beeper_user_notification_counts_stream_ordering SET stream_ordering = ?",
max_stream_ordering,
)
txn.execute("DELETE FROM beeper_user_notification_counts WHERE aggregated")

logger.info(f"Aggregated {len(orders)} notification count rows")

Expand Down

0 comments on commit 90878d6

Please sign in to comment.