Add config settings for background update parameters (#11980)

This commit is contained in:
Shay 2022-03-11 10:46:45 -08:00 committed by GitHub
parent e6a106fd5e
commit ef3619e61d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 430 additions and 34 deletions

View file

@ -39,6 +39,7 @@ class BackgroundUpdatesTestCase(unittest.HomeserverTestCase):
self.store = hs.get_datastores().main
self.admin_user = self.register_user("admin", "pass", admin=True)
self.admin_user_tok = self.login("admin", "pass")
self.updater = BackgroundUpdater(hs, self.store.db_pool)
@parameterized.expand(
[
@ -135,10 +136,10 @@ class BackgroundUpdatesTestCase(unittest.HomeserverTestCase):
"""Test the status API works with a background update."""
# Create a new background update
self._register_bg_update()
self.store.db_pool.updates.start_doing_background_updates()
self.reactor.pump([1.0, 1.0, 1.0])
channel = self.make_request(
@ -158,7 +159,7 @@ class BackgroundUpdatesTestCase(unittest.HomeserverTestCase):
"average_items_per_ms": 0.1,
"total_duration_ms": 1000.0,
"total_item_count": (
BackgroundUpdater.DEFAULT_BACKGROUND_BATCH_SIZE
self.updater.default_background_batch_size
),
}
},
@ -213,7 +214,7 @@ class BackgroundUpdatesTestCase(unittest.HomeserverTestCase):
"average_items_per_ms": 0.1,
"total_duration_ms": 1000.0,
"total_item_count": (
BackgroundUpdater.DEFAULT_BACKGROUND_BATCH_SIZE
self.updater.default_background_batch_size
),
}
},
@ -242,7 +243,7 @@ class BackgroundUpdatesTestCase(unittest.HomeserverTestCase):
"average_items_per_ms": 0.1,
"total_duration_ms": 1000.0,
"total_item_count": (
BackgroundUpdater.DEFAULT_BACKGROUND_BATCH_SIZE
self.updater.default_background_batch_size
),
}
},