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 monitorId = job.data._id;
const maintenanceWindows = const maintenanceWindows =
await this.db.getMaintenanceWindowsByMonitorId(monitorId); await this.db.getMaintenanceWindowsByMonitorId(monitorId);
// Check for active maintenance window: // Check for active maintenance window:
const maintenanceWindowActive = maintenanceWindows.reduce( const maintenanceWindowActive = maintenanceWindows.reduce(
(acc, window) => { (acc, window) => {
@@ -87,9 +86,9 @@ class JobQueue {
const now = new Date(); const now = new Date();
const repeatInterval = window.repeat || 0; const repeatInterval = window.repeat || 0;
while (start < now) { while ((start < now) & (repeatInterval !== 0)) {
start.setDate(start.getTime() + repeatInterval); start.setTime(start.getTime() + repeatInterval);
end.setDate(end.getTime() + repeatInterval); end.setTime(end.getTime() + repeatInterval);
} }
if (start < now && end > now) { if (start < now && end > now) {