Skip to content

Commit

Permalink
Fixed "recurring-interval" type maintenance - added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
buzzinJohnnyBoi committed Jul 13, 2024
1 parent d616883 commit 4750bd1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/model/maintenance.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4750bd1

Please sign in to comment.