diff --git a/changelog.d/17724.misc b/changelog.d/17724.misc new file mode 100644 index 0000000000000000000000000000000000000000..630443f179fa3b312f78e2fc9e1a7ab24b8c2029 --- /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 1194b58ffb68c93a6f40795375a5012dc0150ef0..34139f580d4c8fe011cbfd2c0ce1e9f208c2e53d 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",