diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2022-02-23 11:04:02 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-23 11:04:02 +0000 |
commit | e24ff8ebe3d4119d377355402245947f7de61c00 (patch) | |
tree | 71168892b0f1a555736cc87c166ed229c8949eb3 /synapse/app/phone_stats_home.py | |
parent | Rename default branch of complement.sh to main (#12063) (diff) | |
download | synapse-e24ff8ebe3d4119d377355402245947f7de61c00.tar.xz |
Remove `HomeServer.get_datastore()` (#12031)
The presence of this method was confusing, and mostly present for backwards compatibility. Let's get rid of it. Part of #11733
Diffstat (limited to 'synapse/app/phone_stats_home.py')
-rw-r--r-- | synapse/app/phone_stats_home.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/synapse/app/phone_stats_home.py b/synapse/app/phone_stats_home.py index 899dba5c3d..40dbdace8e 100644 --- a/synapse/app/phone_stats_home.py +++ b/synapse/app/phone_stats_home.py @@ -82,7 +82,7 @@ async def phone_stats_home( # General statistics # - store = hs.get_datastore() + store = hs.get_datastores().main stats["homeserver"] = hs.config.server.server_name stats["server_context"] = hs.config.server.server_context @@ -170,18 +170,22 @@ def start_phone_stats_home(hs: "HomeServer") -> None: # Rather than update on per session basis, batch up the requests. # If you increase the loop period, the accuracy of user_daily_visits # table will decrease - clock.looping_call(hs.get_datastore().generate_user_daily_visits, 5 * 60 * 1000) + clock.looping_call( + hs.get_datastores().main.generate_user_daily_visits, 5 * 60 * 1000 + ) # monthly active user limiting functionality - clock.looping_call(hs.get_datastore().reap_monthly_active_users, 1000 * 60 * 60) - hs.get_datastore().reap_monthly_active_users() + clock.looping_call( + hs.get_datastores().main.reap_monthly_active_users, 1000 * 60 * 60 + ) + hs.get_datastores().main.reap_monthly_active_users() @wrap_as_background_process("generate_monthly_active_users") async def generate_monthly_active_users() -> None: current_mau_count = 0 current_mau_count_by_service = {} reserved_users: Sized = () - store = hs.get_datastore() + store = hs.get_datastores().main if hs.config.server.limit_usage_by_mau or hs.config.server.mau_stats_only: current_mau_count = await store.get_monthly_active_count() current_mau_count_by_service = ( |