From 86300531a9758d4cf08033eaa6929825212ccf2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Ha=C3=9Fel?= Date: Thu, 28 Oct 2021 20:47:46 +0200 Subject: [PATCH] FIX: Endless loop trying to find next Schedule execution --- .../homeautomation/schedule/ScheduleCalculationService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/ph87/homeautomation/schedule/ScheduleCalculationService.java b/src/main/java/de/ph87/homeautomation/schedule/ScheduleCalculationService.java index ea7784c..ce83438 100644 --- a/src/main/java/de/ph87/homeautomation/schedule/ScheduleCalculationService.java +++ b/src/main/java/de/ph87/homeautomation/schedule/ScheduleCalculationService.java @@ -61,7 +61,7 @@ public class ScheduleCalculationService { ZonedDateTime midnight = now.withHour(0).withMinute(0).withSecond(0).withNano(0); ZonedDateTime next = calculateEntryForDay(entry, midnight); while (next != null && (!next.isAfter(now) || !isAfterLast(entry, next) || !isWeekdayEnabled(entry, next))) { - log.debug(" -- skipping: {}", next); + log.debug(" -- skipping: next={}", next); midnight = midnight.plusDays(1); next = calculateEntryForDay(entry, midnight); } @@ -70,7 +70,7 @@ public class ScheduleCalculationService { } private boolean isAfterLast(final ScheduleEntry entry, final ZonedDateTime next) { - return entry.getLastClearTimestamp() == null || !next.isAfter(entry.getLastClearTimestamp()); + return entry.getLastClearTimestamp() == null || next.isAfter(entry.getLastClearTimestamp()); } private ZonedDateTime calculateEntryForDay(final ScheduleEntry entry, final ZonedDateTime midnight) {