From be7a816f786023002e0c46b2d6ab00a389d220a0 Mon Sep 17 00:00:00 2001 From: Andrew Date: Sun, 7 Aug 2022 01:30:59 -0400 Subject: [PATCH 1/3] Fix reaction tasks not firing Fix delay not being accurate --- app/classes/shared/tasks.py | 4 ++-- app/classes/web/panel_handler.py | 2 ++ app/frontend/templates/panel/server_schedule_edit.html | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/classes/shared/tasks.py b/app/classes/shared/tasks.py index 7055d1cb..a654df6d 100644 --- a/app/classes/shared/tasks.py +++ b/app/classes/shared/tasks.py @@ -3,7 +3,7 @@ import time import logging import threading import asyncio -from datetime import datetime +import datetime from tzlocal import get_localzone from tzlocal.utils import ZoneInfoNotFoundError @@ -199,7 +199,7 @@ class TasksManager: "interval", hours=12, id="update_watcher", - start_date=datetime.now(), + start_date=datetime.datetime.now(), ) # self.scheduler.add_job( # self.scheduler.print_jobs, "interval", seconds=10, id="-1" diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py index 2334c862..2a69717e 100644 --- a/app/classes/web/panel_handler.py +++ b/app/classes/web/panel_handler.py @@ -962,6 +962,7 @@ class PanelHandler(BaseHandler): page_data["schedule"]["command"] = "" page_data["schedule"]["one_time"] = False page_data["schedule"]["cron_string"] = "" + page_data["schedule"]["delay"] = 0 page_data["schedule"]["time"] = "" page_data["schedule"]["interval"] = "" # we don't need to check difficulty here. @@ -1041,6 +1042,7 @@ class PanelHandler(BaseHandler): page_data["schedule"]["command"] = schedule.command else: page_data["schedule"]["command"] = "" + page_data["schedule"]["delay"] = schedule.delay page_data["schedule"]["enabled"] = schedule.enabled page_data["schedule"]["one_time"] = schedule.one_time page_data["schedule"]["cron_string"] = schedule.cron_string diff --git a/app/frontend/templates/panel/server_schedule_edit.html b/app/frontend/templates/panel/server_schedule_edit.html index 34057466..943c233e 100644 --- a/app/frontend/templates/panel/server_schedule_edit.html +++ b/app/frontend/templates/panel/server_schedule_edit.html @@ -136,7 +136,8 @@ - +