Self hosted FLOSS fitness/workout, nutrition and weight tracker
Schedule the dynamic category catch-all reconcile daily
Roland Geiderbe593c6daeff
diff --git a/wger/measurements/tasks.py b/wger/measurements/tasks.pyindex 412d5400c..139ff8f79 100644--- a/wger/measurements/tasks.py+++ b/wger/measurements/tasks.py@@ -15,6 +15,10 @@# Standard Libraryimport logging+import random++# Third Party+from celery.schedules import crontab# wgerfrom wger.celery_configuration import app@@ -47,3 +51,15 @@ def reconcile_all_dynamic_categories_task():reconcile(category)count += 1logger.info(f'Reconciled {count} dynamic measurement categories')++[email protected]_after_finalize.connect+def setup_periodic_tasks(sender, **kwargs):+ sender.add_periodic_task(+ crontab(+ hour=str(random.randint(0, 23)),+ minute=str(random.randint(0, 59)),+ ),+ reconcile_all_dynamic_categories_task.s(),+ name='Reconcile dynamic measurement categories',+ )