summary refs log tree commit diff
path: root/synapse/handlers/pagination.py
diff options
context:
space:
mode:
authorMathieu Velten <mathieuv@matrix.org>2023-06-09 15:14:59 +0200
committerMathieu Velten <mathieuv@matrix.org>2023-06-09 15:14:59 +0200
commit5b83e0df39a22d0e18c0ea4b942cd8139d2bd019 (patch)
treec9e2e51ea86c0d2712fcbe991145e924dfa43c3b /synapse/handlers/pagination.py
parentLess quotes (diff)
downloadsynapse-5b83e0df39a22d0e18c0ea4b942cd8139d2bd019.tar.xz
Address comments
Diffstat (limited to 'synapse/handlers/pagination.py')
-rw-r--r--synapse/handlers/pagination.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/synapse/handlers/pagination.py b/synapse/handlers/pagination.py

index bf10f929dd..74fe9902a8 100644 --- a/synapse/handlers/pagination.py +++ b/synapse/handlers/pagination.py
@@ -163,8 +163,8 @@ class PaginationHandler: or status == DeleteStatus.STATUS_FAILED ): # remove the delete from the list 24 hours after it completes or fails - time_since_completed = self.clock.time_msec() - timestamp - if time_since_completed >= PaginationHandler.CLEAR_PURGE_AFTER_MS: + ms_since_completed = self.clock.time_msec() - timestamp + if ms_since_completed >= PaginationHandler.CLEAR_PURGE_AFTER_MS: await self.store.delete_room_to_purge(room_id, delete_id) del self._delete_by_id[delete_id] @@ -199,12 +199,15 @@ class PaginationHandler: ) continue - # launch a purge from the DB - # it may be an interrupted purge or a scheduled one - purge_now = True if status == DeleteStatus.STATUS_PURGING else False - if status == DeleteStatus.STATUS_WAIT_PURGE: - if timestamp is None or self.clock.time_msec() >= timestamp: - purge_now = True + # If the database says we were last in the middle of purging the room, + # let's continue the purge process. + if status == DeleteStatus.STATUS_PURGING: + purge_now = True + # Or if we're at or past the scheduled purge time, let's start that one as well + elif status == DeleteStatus.STATUS_SCHEDULED_PURGE and ( + timestamp is None or self.clock.time_msec() >= timestamp + ): + purge_now = True # TODO 2 stages purge, keep memberships for a while so we don't "break" sync if purge_now: