Skip to content

Commit

Permalink
Sliding Sync: Shortcut for checking if certain background updates hav…
Browse files Browse the repository at this point in the history
…e completed (#17724)

Shortcut for checking if certain background updates have completed

Pulling this change out from one of @erikjohnston's branches
(develop...erikj/ss_perf)

---------

Co-authored-by: Erik Johnston <[email protected]>
  • Loading branch information
MadLittleMods and erikjohnston authored Sep 18, 2024
1 parent 3c8a116 commit 61b7c31
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/17724.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Shortcut for checking if certain background updates have completed (utilized in Sliding Sync).
6 changes: 6 additions & 0 deletions synapse/storage/background_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,12 @@ async def have_completed_background_updates(
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",
Expand Down

0 comments on commit 61b7c31

Please sign in to comment.