@@ -620,16 +620,18 @@ def generate_user_daily_visit_stats():
620
620
# Rather than update on per session basis, batch up the requests.
621
621
# If you increase the loop period, the accuracy of user_daily_visits
622
622
# table will decrease
623
- clock .looping_call (generate_user_daily_visit_stats , 5 * 60 * 1000 )
623
+ if hs .config .run_background_tasks :
624
+ clock .looping_call (generate_user_daily_visit_stats , 5 * 60 * 1000 )
624
625
625
626
# monthly active user limiting functionality
626
627
def reap_monthly_active_users ():
627
628
return run_as_background_process (
628
629
"reap_monthly_active_users" , hs .get_datastore ().reap_monthly_active_users
629
630
)
630
631
631
- clock .looping_call (reap_monthly_active_users , 1000 * 60 * 60 )
632
- reap_monthly_active_users ()
632
+ if hs .config .run_background_tasks :
633
+ clock .looping_call (reap_monthly_active_users , 1000 * 60 * 60 )
634
+ reap_monthly_active_users ()
633
635
634
636
async def generate_monthly_active_users ():
635
637
current_mau_count = 0
@@ -656,11 +658,13 @@ def start_generate_monthly_active_users():
656
658
)
657
659
658
660
start_generate_monthly_active_users ()
659
- if hs .config .limit_usage_by_mau or hs .config .mau_stats_only :
661
+ if hs .config .run_background_tasks and (
662
+ hs .config .limit_usage_by_mau or hs .config .mau_stats_only
663
+ ):
660
664
clock .looping_call (start_generate_monthly_active_users , 5 * 60 * 1000 )
661
665
# End of monthly active user settings
662
666
663
- if hs .config .report_stats :
667
+ if hs .config .run_background_tasks and hs . config . report_stats :
664
668
logger .info ("Scheduling stats reporting for 3 hour intervals" )
665
669
clock .looping_call (start_phone_stats_home , 3 * 60 * 60 * 1000 )
666
670
0 commit comments