mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 02:44:53 -04:00
Move background update handling out of store
This commit is contained in:
parent
8863624f78
commit
4a33a6dd19
27 changed files with 281 additions and 200 deletions
|
@ -202,8 +202,12 @@ class ClientIpStoreTestCase(unittest.HomeserverTestCase):
|
|||
|
||||
def test_devices_last_seen_bg_update(self):
|
||||
# First make sure we have completed all updates.
|
||||
while not self.get_success(self.store.has_completed_background_updates()):
|
||||
self.get_success(self.store.do_next_background_update(100), by=0.1)
|
||||
while not self.get_success(
|
||||
self.store.db.updates.has_completed_background_updates()
|
||||
):
|
||||
self.get_success(
|
||||
self.store.db.updates.do_next_background_update(100), by=0.1
|
||||
)
|
||||
|
||||
# Insert a user IP
|
||||
user_id = "@user:id"
|
||||
|
@ -256,11 +260,15 @@ class ClientIpStoreTestCase(unittest.HomeserverTestCase):
|
|||
)
|
||||
|
||||
# ... and tell the DataStore that it hasn't finished all updates yet
|
||||
self.store._all_done = False
|
||||
self.store.db.updates._all_done = False
|
||||
|
||||
# Now let's actually drive the updates to completion
|
||||
while not self.get_success(self.store.has_completed_background_updates()):
|
||||
self.get_success(self.store.do_next_background_update(100), by=0.1)
|
||||
while not self.get_success(
|
||||
self.store.db.updates.has_completed_background_updates()
|
||||
):
|
||||
self.get_success(
|
||||
self.store.db.updates.do_next_background_update(100), by=0.1
|
||||
)
|
||||
|
||||
# We should now get the correct result again
|
||||
result = self.get_success(
|
||||
|
@ -281,8 +289,12 @@ class ClientIpStoreTestCase(unittest.HomeserverTestCase):
|
|||
|
||||
def test_old_user_ips_pruned(self):
|
||||
# First make sure we have completed all updates.
|
||||
while not self.get_success(self.store.has_completed_background_updates()):
|
||||
self.get_success(self.store.do_next_background_update(100), by=0.1)
|
||||
while not self.get_success(
|
||||
self.store.db.updates.has_completed_background_updates()
|
||||
):
|
||||
self.get_success(
|
||||
self.store.db.updates.do_next_background_update(100), by=0.1
|
||||
)
|
||||
|
||||
# Insert a user IP
|
||||
user_id = "@user:id"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue