From 3ddd8c9cceb6b4cb66e0c346e7665b023e18a977 Mon Sep 17 00:00:00 2001
From: Jennifer Richards <jennifer@staff.ietf.org>
Date: Wed, 28 Feb 2024 10:15:04 -0400
Subject: [PATCH] fix: Fix/adjust periodic_tasks management command (#7108)

* fix: Skip midnight partial rfced sync

* fix: call iana protocols update task correctly
---
 ietf/utils/management/commands/periodic_tasks.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/ietf/utils/management/commands/periodic_tasks.py b/ietf/utils/management/commands/periodic_tasks.py
index 14a21fe96..e35938283 100644
--- a/ietf/utils/management/commands/periodic_tasks.py
+++ b/ietf/utils/management/commands/periodic_tasks.py
@@ -12,6 +12,7 @@ CRONTAB_DEFS = {
         "day_of_month": "*",
         "month_of_year": "*",
         "day_of_week": "0",
+        "timezone": "America/Los_Angeles",
     },
     "daily": {
         "minute": "5",
@@ -19,6 +20,7 @@ CRONTAB_DEFS = {
         "day_of_month": "*",
         "month_of_year": "*",
         "day_of_week": "*",
+        "timezone": "America/Los_Angeles",
     },
     "hourly": {
         "minute": "5",
@@ -34,6 +36,14 @@ CRONTAB_DEFS = {
         "month_of_year": "*",
         "day_of_week": "*",
     },
+    "every_15m_except_midnight": {
+        "minute": "*/15",
+        "hour": "1-23",
+        "day_of_month": "*",
+        "month_of_year": "*",
+        "day_of_week": "*",
+        "timezone": "America/Los_Angeles",
+    },
 }
 
 
@@ -79,7 +89,7 @@ class Command(BaseCommand):
             kwargs=json.dumps(dict(full_index=False)),
             defaults=dict(
                 enabled=False,
-                crontab=self.crontabs["every_15m"],
+                crontab=self.crontabs["every_15m_except_midnight"],  # don't collide with full sync
                 description=(
                     "Reparse the last _year_ of RFC index entries until "
                     "https://github.com/ietf-tools/datatracker/issues/3734 is addressed. "
@@ -143,7 +153,7 @@ class Command(BaseCommand):
 
         PeriodicTask.objects.get_or_create(
             name="Sync with IANA protocols page",
-            task="ietf.sync.tasks.iana_changes_update_task",
+            task="ietf.sync.tasks.iana_protocols_update_task",
             defaults=dict(
                 enabled=False,
                 crontab=self.crontabs["hourly"],