From 95411c79cb4101c7173d12188f98b9df6d9f8d2f Mon Sep 17 00:00:00 2001 From: Ariel Rin Date: Mon, 3 Mar 2025 01:19:32 +0000 Subject: [PATCH] Crontab --- allianceauth/crontab/schedulers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/allianceauth/crontab/schedulers.py b/allianceauth/crontab/schedulers.py index 9a678cf5..940f2857 100644 --- a/allianceauth/crontab/schedulers.py +++ b/allianceauth/crontab/schedulers.py @@ -40,10 +40,11 @@ class OffsetDatabaseScheduler(DatabaseScheduler): for name, entry_fields in mapping.items(): try: - apply_offset = entry_fields.pop("apply_offset", False) # Ensure this pops before django tries to save to ORM + apply_offset = entry_fields.pop("apply_offset", False) # Ensure this pops before django tries to save to ORM entry = self.Entry.from_entry(name, app=self.app, **entry_fields) if apply_offset: + entry_fields.update({"apply_offset": apply_offset}) # Reapply this as its gets pulled from config inconsistently. schedule_obj = entry.schedule if isinstance(schedule_obj, schedules.crontab): offset_cs = CrontabSchedule.from_schedule(offset_cron(schedule_obj)) @@ -55,6 +56,7 @@ class OffsetDatabaseScheduler(DatabaseScheduler): day_of_week=offset_cs.day_of_week, timezone=offset_cs.timezone, ) + entry.schedule = offset_cron(schedule_obj) # This gets passed into Celery Beats Memory, important to keep it in sync with the model/DB entry.model.crontab = offset_cs entry.model.save() logger.debug(f"Offset applied for '{name}' due to 'apply_offset' = True.")