mirror of
https://github.com/ansible/awx.git
synced 2026-05-13 04:17:36 -02:30
More precise handling of schedule computed fields no-ops
Do not set a next_run value for disabled schedules Bail if no fields are changed Do not update related template if its fields did not change Change call pattern to schedule.update_computed_fields() in doing so, fix bug where template does not pick up schedule due to schedules next_run not being saved Handle the case (also a bug) where template was not updated when schedule was deleted
This commit is contained in:
@@ -107,9 +107,6 @@ def dispatch_startup():
|
||||
for sch in Schedule.objects.all():
|
||||
try:
|
||||
sch.update_computed_fields()
|
||||
from awx.main.signals import disable_activity_stream
|
||||
with disable_activity_stream():
|
||||
sch.save()
|
||||
except Exception:
|
||||
logger.exception("Failed to rebuild schedule {}.".format(sch))
|
||||
|
||||
@@ -496,7 +493,7 @@ def awx_periodic_scheduler():
|
||||
|
||||
old_schedules = Schedule.objects.enabled().before(last_run)
|
||||
for schedule in old_schedules:
|
||||
schedule.save()
|
||||
schedule.update_computed_fields()
|
||||
schedules = Schedule.objects.enabled().between(last_run, run_now)
|
||||
|
||||
invalid_license = False
|
||||
@@ -507,7 +504,7 @@ def awx_periodic_scheduler():
|
||||
|
||||
for schedule in schedules:
|
||||
template = schedule.unified_job_template
|
||||
schedule.save() # To update next_run timestamp.
|
||||
schedule.update_computed_fields() # To update next_run timestamp.
|
||||
if template.cache_timeout_blocked:
|
||||
logger.warn("Cache timeout is in the future, bypassing schedule for template %s" % str(template.id))
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user