mirror of
https://github.com/element-hq/synapse.git
synced 2025-12-08 00:00:52 -05: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:
parent
e67ba69f20
commit
938c97416d
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")
|
txn.execute("SELECT event_id, should_delete FROM events_to_purge")
|
||||||
event_rows = txn.fetchall()
|
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(
|
logger.info(
|
||||||
"[purge] found %i events before cutoff, of which %i can be deleted",
|
"[purge] found %i events before cutoff, of which %i can be deleted",
|
||||||
len(event_rows),
|
len(event_rows),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user