Fix scheduled task disable

This commit is contained in:
amcmanu3 2022-10-04 16:07:08 -04:00
parent 2706ffddbe
commit 3681f52856
2 changed files with 10 additions and 2 deletions

View File

@ -436,6 +436,14 @@ class TasksManager:
and "cron_string" in job_data and "cron_string" in job_data
and "interval_type" in job_data and "interval_type" in job_data
): ):
if not "enabled" in job_data:
return
else:
if job_data["enabled"] is True:
job_data = HelpersManagement.get_scheduled_task(sch_id)
job_data["server_id"] = job_data["server_id"]["server_id"]
else:
self.scheduler.remove_job(str(sch_id))
return return
try: try:

View File

@ -97,7 +97,7 @@ class ApiServersServerTasksTaskIndexHandler(BaseApiHandler):
if str(data.get("parent")) == str(task_id) and data.get("parent") is not None: if str(data.get("parent")) == str(task_id) and data.get("parent") is not None:
data["parent"] = None data["parent"] = None
HelpersManagement.update_scheduled_task(task_id, data) self.tasks_manager.update_job(task_id, data)
self.controller.management.add_to_audit_log( self.controller.management.add_to_audit_log(
auth_data[4]["user_id"], auth_data[4]["user_id"],