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.")