mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-09 04:20:17 +02:00
Crontab
This commit is contained in:
parent
f4d3d6c0b1
commit
95411c79cb
@ -40,10 +40,11 @@ class OffsetDatabaseScheduler(DatabaseScheduler):
|
|||||||
|
|
||||||
for name, entry_fields in mapping.items():
|
for name, entry_fields in mapping.items():
|
||||||
try:
|
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)
|
entry = self.Entry.from_entry(name, app=self.app, **entry_fields)
|
||||||
|
|
||||||
if apply_offset:
|
if apply_offset:
|
||||||
|
entry_fields.update({"apply_offset": apply_offset}) # Reapply this as its gets pulled from config inconsistently.
|
||||||
schedule_obj = entry.schedule
|
schedule_obj = entry.schedule
|
||||||
if isinstance(schedule_obj, schedules.crontab):
|
if isinstance(schedule_obj, schedules.crontab):
|
||||||
offset_cs = CrontabSchedule.from_schedule(offset_cron(schedule_obj))
|
offset_cs = CrontabSchedule.from_schedule(offset_cron(schedule_obj))
|
||||||
@ -55,6 +56,7 @@ class OffsetDatabaseScheduler(DatabaseScheduler):
|
|||||||
day_of_week=offset_cs.day_of_week,
|
day_of_week=offset_cs.day_of_week,
|
||||||
timezone=offset_cs.timezone,
|
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.crontab = offset_cs
|
||||||
entry.model.save()
|
entry.model.save()
|
||||||
logger.debug(f"Offset applied for '{name}' due to 'apply_offset' = True.")
|
logger.debug(f"Offset applied for '{name}' due to 'apply_offset' = True.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user