Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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/19093.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a shortcut return when there are no events to purge.
10 changes: 10 additions & 0 deletions synapse/storage/databases/main/purge_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,16 @@ def _purge_history_txn(

txn.execute("SELECT event_id, should_delete FROM events_to_purge")
event_rows = txn.fetchall()

if len(event_rows) == 0:
logger.info("[purge] no events found to purge")

# For the sake of cleanliness: drop the temp table.
# This will commit the txn in sqlite, so make sure to keep this actually last.
txn.execute("DROP TABLE events_to_purge")
# no referenced state groups
return set()

logger.info(
"[purge] found %i events before cutoff, of which %i can be deleted",
len(event_rows),
Expand Down
Loading