summary refs log tree commit diff
diff options
context:
space:
mode:
authorEric Eastwood <eric.eastwood@beta.gouv.fr>2024-09-18 13:12:14 -0500
committerGitHub <noreply@github.com>2024-09-18 13:12:14 -0500
commit61b7c31772034fe63b311bd63d7c3d7e24551cdf (patch)
tree420c50d034e3c23e6497fc26cf31c90a824c8c1f
parentSliding Sync: bugfix: ensure we can sync with SSS even with missing rooms (#1... (diff)
downloadsynapse-61b7c31772034fe63b311bd63d7c3d7e24551cdf.tar.xz
Sliding Sync: Shortcut for checking if certain background updates have completed (#17724)
Shortcut for checking if certain background updates have completed

Pulling this change out from one of @erikjohnston's branches
(https://github.com/element-hq/synapse/compare/develop...erikj/ss_perf)

---------

Co-authored-by: Erik Johnston <erikj@element.io>
-rw-r--r--changelog.d/17724.misc1
-rw-r--r--synapse/storage/background_updates.py6
2 files changed, 7 insertions, 0 deletions
diff --git a/changelog.d/17724.misc b/changelog.d/17724.misc
new file mode 100644

index 0000000000..630443f179 --- /dev/null +++ b/changelog.d/17724.misc
@@ -0,0 +1 @@ +Shortcut for checking if certain background updates have completed (utilized in Sliding Sync). diff --git a/synapse/storage/background_updates.py b/synapse/storage/background_updates.py
index 1194b58ffb..34139f580d 100644 --- a/synapse/storage/background_updates.py +++ b/synapse/storage/background_updates.py
@@ -490,6 +490,12 @@ class BackgroundUpdater: if self._all_done: return True + # We now check if we have completed all pending background updates. We + # do this as once this returns True then it will set `self._all_done` + # and we can skip checking the database in future. + if await self.has_completed_background_updates(): + return True + rows = await self.db_pool.simple_select_many_batch( table="background_updates", column="update_name",