Hi team,
If we create two similar schedules but set one to start only one hour from now, the getNextActionTimes()
returns invalid values.
Instant now = Instant.now();
List<ScheduleCalendarSpec> calendarSpec = List.of(
ScheduleCalendarSpec.newBuilder()
.setSeconds(List.of(new ScheduleRange(now.atOffset(ZoneOffset.UTC).getSecond())))
.setMinutes(List.of(new ScheduleRange(now.atOffset(ZoneOffset.UTC).getMinute())))
.setHour(List.of(new ScheduleRange(0, 23)))
.build());
System.out.println("Now: " + now);
for (int i = 0; i <= 1; i++) {
scheduleClient.createSchedule("scheduleId" + i,
Schedule.newBuilder()
.setAction(action).setSpec(ScheduleSpec.newBuilder()
.setStartAt(now.plus(i, ChronoUnit.HOURS))
.setCalendars(calendarSpec).build()).build(),
ScheduleOptions.newBuilder().build());
System.out.println("Schedule " + i);
scheduleClient.getHandle("scheduleId" + i).describe().getInfo()
.getNextActionTimes().forEach(System.out::println);
}
Output of this code:
Schedule 0
2024-05-27T19:22:10Z
2024-05-27T20:22:10Z
2024-05-27T21:22:10Z
2024-05-27T22:22:10Z
2024-05-27T23:22:10Z
(...)
Schedule 1
2024-05-27T19:22:10Z
2024-05-27T19:22:10Z
2024-05-27T19:22:10Z
2024-05-27T19:22:10Z
2024-05-27T19:22:10Z
(...)
I would expect the hours for Schedule 1
to start at 2024-05-27T20:22:10Z
and increment by one hour just like Schedule 0
.
Why does this happen? Is this a expected behaviour?
Thank you.