membershipworks: Remove simple-history duplicates every hour

This commit is contained in:
Adam Goldsmith 2024-08-28 18:03:30 -04:00
parent 0cd88c00f1
commit 1255d0ddc6
2 changed files with 15 additions and 0 deletions

View File

@ -9,6 +9,7 @@ def post_migrate_callback(sender, **kwargs):
from .tasks.event_survey_emails import send_survey_emails from .tasks.event_survey_emails import send_survey_emails
from .tasks.scrape import scrape_events, scrape_membershipworks from .tasks.scrape import scrape_events, scrape_membershipworks
from .tasks.simple_history import q_clean_duplicate_history
from .tasks.ucsAccounts import sync_accounts from .tasks.ucsAccounts import sync_accounts
ensure_scheduled( ensure_scheduled(
@ -32,6 +33,11 @@ def post_migrate_callback(sender, **kwargs):
schedule_type=Schedule.HOURLY, schedule_type=Schedule.HOURLY,
) )
ensure_scheduled(
q_clean_duplicate_history,
schedule_type=Schedule.HOURLY,
)
class MembershipworksConfig(AppConfig): class MembershipworksConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField" default_auto_field = "django.db.models.BigAutoField"

View File

@ -0,0 +1,9 @@
import django.core.management
from cmsmanage.django_q2_helper import q_task_group
# TODO: this probably should be more global, instead of owned by membershipworks app
@q_task_group("Clean Duplicate History")
def q_clean_duplicate_history():
django.core.management.call_command("clean_duplicate_history", "--auto")