Skip to content

Commit 61b7c31

Browse files
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 (develop...erikj/ss_perf) --------- Co-authored-by: Erik Johnston <erikj@element.io>
1 parent 3c8a116 commit 61b7c31

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

changelog.d/17724.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Shortcut for checking if certain background updates have completed (utilized in Sliding Sync).

synapse/storage/background_updates.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,12 @@ async def have_completed_background_updates(
490490
if self._all_done:
491491
return True
492492

493+
# We now check if we have completed all pending background updates. We
494+
# do this as once this returns True then it will set `self._all_done`
495+
# and we can skip checking the database in future.
496+
if await self.has_completed_background_updates():
497+
return True
498+
493499
rows = await self.db_pool.simple_select_many_batch(
494500
table="background_updates",
495501
column="update_name",

0 commit comments

Comments
 (0)