Fix date/time error in JobQueue

This commit is contained in:
Alex Holliday committed 2024-10-04 13:04:18 +08:00
1 parent f5547a1825
commit 22a0caf919
1 file changed
+3 -4
+3 -4
View File
@@ -77,7 +77,6 @@ class JobQueue {
const monitorId = job.data._id;
const maintenanceWindows =
await this.db.getMaintenanceWindowsByMonitorId(monitorId);
// Check for active maintenance window:
const maintenanceWindowActive = maintenanceWindows.reduce(
(acc, window) => {
@@ -87,9 +86,9 @@ class JobQueue {
const now = new Date();
const repeatInterval = window.repeat || 0;
while (start < now) {
start.setDate(start.getTime() + repeatInterval);
end.setDate(end.getTime() + repeatInterval);
while ((start < now) & (repeatInterval !== 0)) {
start.setTime(start.getTime() + repeatInterval);
end.setTime(end.getTime() + repeatInterval);
}
if (start < now && end > now) {