FIX: nextFuzzyTimestamp in past

This commit is contained in:
Patrick Haßel 2024-09-12 09:29:35 +02:00
parent 1c0ffc7b64
commit c174a18a4a

View File

@ -92,14 +92,16 @@ public class ScheduleEntry {
public void setNextClearTimestamp(final ZonedDateTime next) {
nextClearTimestamp = next;
if (nextClearTimestamp == null) {
nextFuzzyTimestamp = null;
} else {
if (nextClearTimestamp != null) {
final int rangeFull = 2 * fuzzySeconds;
final ZonedDateTime min = ZonedDateTime.now().plusMinutes(1);
while (nextFuzzyTimestamp == null || nextFuzzyTimestamp.isBefore(min)) {
final int fuzzySeconds = rangeFull > 0 ? RANDOM.nextInt(rangeFull) - this.fuzzySeconds : 0;
nextFuzzyTimestamp = nextClearTimestamp.plusSeconds(fuzzySeconds);
}
}
}
@Override
public String toString() {