mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Merge pull request #4076 from matrix-org/rav/fix_init_logcontexts
Run MAU queries as background processes
This commit is contained in:
commit
7aea00069c
1
changelog.d/4076.misc
Normal file
1
changelog.d/4076.misc
Normal file
@ -0,0 +1 @@
|
||||
Correctly manage logcontexts during startup to fix some "Unexpected logging context" warnings
|
@ -527,10 +527,13 @@ def run(hs):
|
||||
clock.looping_call(generate_user_daily_visit_stats, 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()
|
||||
def reap_monthly_active_users():
|
||||
return run_as_background_process(
|
||||
"reap_monthly_active_users",
|
||||
hs.get_datastore().reap_monthly_active_users,
|
||||
)
|
||||
clock.looping_call(reap_monthly_active_users, 1000 * 60 * 60)
|
||||
reap_monthly_active_users()
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def generate_monthly_active_users():
|
||||
@ -544,12 +547,23 @@ def run(hs):
|
||||
registered_reserved_users_mau_gauge.set(float(reserved_count))
|
||||
max_mau_gauge.set(float(hs.config.max_mau_value))
|
||||
|
||||
hs.get_datastore().initialise_reserved_users(
|
||||
hs.config.mau_limits_reserved_threepids
|
||||
def start_generate_monthly_active_users():
|
||||
return run_as_background_process(
|
||||
"generate_monthly_active_users",
|
||||
generate_monthly_active_users,
|
||||
)
|
||||
|
||||
# XXX is this really supposed to be a background process? it looks
|
||||
# like it needs to complete before some of the other stuff runs.
|
||||
run_as_background_process(
|
||||
"initialise_reserved_users",
|
||||
hs.get_datastore().initialise_reserved_users,
|
||||
hs.config.mau_limits_reserved_threepids,
|
||||
)
|
||||
generate_monthly_active_users()
|
||||
|
||||
start_generate_monthly_active_users()
|
||||
if hs.config.limit_usage_by_mau:
|
||||
clock.looping_call(generate_monthly_active_users, 5 * 60 * 1000)
|
||||
clock.looping_call(start_generate_monthly_active_users, 5 * 60 * 1000)
|
||||
# End of monthly active user settings
|
||||
|
||||
if hs.config.report_stats:
|
||||
|
Loading…
Reference in New Issue
Block a user