shyiko / skedule

A human-friendly alternative to cron. Designed after GAE's schedule for Kotlin and/or Java 8+.
84 stars 7 forks source link

scheduleiterator looping over the same value over and over again #6

Open Globegitter opened 4 years ago

Globegitter commented 4 years ago

I have a schedule setup as follows:

val now = ZonedDateTime.now(ZoneId.of("UTC"))
val scheduleIterator = Schedule.at(now.plusNanos(1000).toLocalTime()).everyDay().iterate(now)
println(scheduleIterator.next())
println(scheduleIterator.next())
println(scheduleIterator.next())
...

and all calls to next print exactly the same ZonedDateTime. Is that an issue with the library or am I using this somehow wrong?

Globegitter commented 4 years ago

I have noticed that for example Schedule.parse("every day 09:00").iterate(now) works like I would have expected and iterates over the future values just fine.

Globegitter commented 4 years ago

Interesting, also if I do Schedule.at(LocalTime.MIDNIGHT) or Schedule.at(LocalTime.NOON) it works as expected.

Globegitter commented 4 years ago

Ha, if I change my code above to Schedule.at(now.plusMinutes(1).withNano(0).withSecond(0).toLocalTime()).everyDay() it also works fine. So that does seem like a bug to me and possibly related to https://github.com/shyiko/skedule/issues/1

Zomis commented 3 years ago

I also encountered this bug and would very gladly like to see this fixed. It could have caused lots of issues for me if I wouldn't have noticed it (continuously spamming several servers with HTTP requests)

Sadly it doesn't look like this library is maintained at the moment.