From 4750bd1e3693869a0674d1ff11feab555724c71a Mon Sep 17 00:00:00 2001 From: buzzinJohnnyBoi Date: Sat, 13 Jul 2024 14:08:53 -0400 Subject: [PATCH] Fixed "recurring-interval" type maintenance - added comments --- server/model/maintenance.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/model/maintenance.js b/server/model/maintenance.js index 7aa824ff..6eb5273b 100644 --- a/server/model/maintenance.js +++ b/server/model/maintenance.js @@ -254,7 +254,7 @@ class Maintenance extends BeanModel { } if (duration === undefined && this.strategy === "recurring-interval") { - duration = this.duration * 1000; + duration = this.duration * 1000; // For recurring-interval, the duration needs to be defined } UptimeKumaServer.getInstance().sendMaintenanceListByUserID(this.user_id); @@ -268,6 +268,7 @@ class Maintenance extends BeanModel { // Create Cron if (this.strategy === "recurring-interval") { + // For recurring-interval, Croner needs to have interval and startAt const startDate = dayjs(this.startDate); const [ hour, minute ] = this.startTime.split(":"); const startDateTime = startDate.hour(hour).minute(minute); @@ -410,7 +411,7 @@ class Maintenance extends BeanModel { } else if (!this.strategy.startsWith("recurring-")) { this.cron = ""; } else if (this.strategy === "recurring-interval") { - this.cron = "* * * * *"; + this.cron = "* * * * *"; // Because it is interval, it will be calculated in the run function this.duration = this.calcDuration(); log.debug("maintenance", "Cron: " + this.cron); log.debug("maintenance", "Duration: " + this.duration);