mirror of
https://github.com/element-hq/synapse.git
synced 2025-12-05 01:10:13 +00:00
Add a shortcut return when there are no events to purge. (#19093)
Fixes: #13417 --------- Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org>
This commit is contained in:
1
changelog.d/19093.misc
Normal file
1
changelog.d/19093.misc
Normal file
@@ -0,0 +1 @@
|
||||
Add a shortcut return when there are no events to purge.
|
||||
@@ -239,6 +239,16 @@ class PurgeEventsStore(StateGroupWorkerStore, CacheInvalidationWorkerStore):
|
||||
|
||||
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),
|
||||
|
||||
Reference in New Issue
Block a user