sched = later.parse.recur().every(1).minute()
compSched = later.schedule sched
console.log compSched.next(10)
later.setInterval (-> update()), sched
update = ->
# there is an async delay here of approx 7-8 seconds
console.log compSched.next(2)
[Fri Aug 09 2013 12:53:55 GMT-0700 (Pacific Daylight Time), Fri Aug 09 2013 12:54:00 GMT-0700 (Pacific Daylight Time), Fri Aug 09 2013 12:55:00 GMT-0700 (Pacific Daylight Time), Fri Aug 09 2013 12:56:00 GMT-0700 (Pacific Daylight Time), Fri Aug 09 2013 12:57:00 GMT-0700 (Pacific Daylight Time), Fri Aug 09 2013 12:58:00 GMT-0700 (Pacific Daylight Time), Fri Aug 09 2013 12:59:00 GMT-0700 (Pacific Daylight Time), Fri Aug 09 2013 13:00:00 GMT-0700 (Pacific Daylight Time), Fri Aug 09 2013 13:01:00 GMT-0700 (Pacific Daylight Time), Fri Aug 09 2013 13:02:00 GMT-0700 (Pacific Daylight Time)]
I don't understand why the the initial entry is there, which corresponds to the time the code was first run. Shouldn't the initial next value be the next "round" minute, i.e. the second entry?
[Fri Aug 09 2013 12:54:07 GMT-0700 (Pacific Daylight Time), Fri Aug 09 2013 12:55:00 GMT-0700 (Pacific Daylight Time)]
The seven seconds corresponds to the async delay but why is it showing up at all as the "next" scheduled occurrence? I was expecting that the first element in any call to next
would be the next scheduled execution time but it seems I have to get the second array element instead. Is this expected behavior? I think this is a bug because it doesn't match the documented behavior of next
.