0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-06-01 18:28:56 +02:00

Fix case in wait_for_background_updates where self.store does not exist (#11331)

Pull the DataStore from the HomeServer instance, which
always exists.
This commit is contained in:
Andrew Morgan 2021-12-07 16:51:53 +00:00 committed by GitHub
parent 26b5d2320f
commit d6fb96e056
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

1
changelog.d/11331.misc Normal file
View file

@ -0,0 +1 @@
A test helper (`wait_for_background_updates`) no longer depends on classes defining a `store` property.

View file

@ -331,16 +331,13 @@ class HomeserverTestCase(TestCase):
time.sleep(0.01)
def wait_for_background_updates(self) -> None:
"""Block until all background database updates have completed.
Note that callers must ensure there's a store property created on the
testcase.
"""
"""Block until all background database updates have completed."""
store = self.hs.get_datastore()
while not self.get_success(
self.store.db_pool.updates.has_completed_background_updates()
store.db_pool.updates.has_completed_background_updates()
):
self.get_success(
self.store.db_pool.updates.do_next_background_update(False), by=0.1
store.db_pool.updates.do_next_background_update(False), by=0.1
)
def make_homeserver(self, reactor, clock):