Skip to content

Reduce disk wastage by cleaning up received_transactions older than 1 day, rather than 30 days. #18310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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/18310.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reduce disk wastage by cleaning up `received_transactions` older than 1 day, rather than 30 days.
4 changes: 2 additions & 2 deletions synapse/storage/databases/main/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ def __init__(
@wrap_as_background_process("cleanup_transactions")
async def _cleanup_transactions(self) -> None:
now = self._clock.time_msec()
month_ago = now - 30 * 24 * 60 * 60 * 1000
day_ago = now - 24 * 60 * 60 * 1000

def _cleanup_transactions_txn(txn: LoggingTransaction) -> None:
txn.execute("DELETE FROM received_transactions WHERE ts < ?", (month_ago,))
txn.execute("DELETE FROM received_transactions WHERE ts < ?", (day_ago,))

await self.db_pool.runInteraction(
"_cleanup_transactions", _cleanup_transactions_txn
Expand Down
Loading