Closed andrewthad closed 9 years ago
I added a test case for this and it passed. Please have a look.
That indicates that it should be working. I'll check this out again when I get back to the office. Thanks for looking at it.
Any update on this?
Sorry I dropped the ball on this. I've tried it again with a more minimal case. It looks like this:
scheduleAllJobs :: App -> IO ()
scheduleAllJobs app = do
_ <- execSchedule $ do
addJob (heartbeat app) "* * * * *"
addJob (flip runReaderT app $ Task.log "Odd Minute") "1-59/2 * * * *"
addJob (flip runReaderT app $ Task.log "Even Minute") "0-59/2 * * * *"
I would expect to see the heartbeat every minute and the odd and even notifications on alternating minutes. Here's what I get instead:
17/Jul/2015:15:17:59 -0400 Even Minute
17/Jul/2015:15:17:59 -0400 Odd Minute
17/Jul/2015:15:17:59 -0400 Repeated jobs heartbeat
17/Jul/2015:15:18:59 -0400 Repeated jobs heartbeat
17/Jul/2015:15:19:59 -0400 Even Minute
17/Jul/2015:15:19:59 -0400 Odd Minute
17/Jul/2015:15:19:59 -0400 Repeated jobs heartbeat
17/Jul/2015:15:20:59 -0400 Repeated jobs heartbeat
17/Jul/2015:15:21:59 -0400 Even Minute
17/Jul/2015:15:21:59 -0400 Odd Minute
17/Jul/2015:15:21:59 -0400 Repeated jobs heartbeat
So, even though your test shows that it parses correctly, I think that the parsed result is being used incorrectly somewhere. The event that should fire on the odd minutes is firing on the even minutes.
I suspect that there's a problem in the scheduleMatches
function, but it's hard for me to understand how that function works.
I'm updating the name of this issue to reflect the understand of it that I now have.
Really sorry it took so long. Been pretty behind on my open source stuff. I found a bug in the range calculation function. Wrote a test for the exact times you specified and made it pass. Please give the above mentioned patch a try and let me know if it fixes your issue :)
That's alright. I'm always behind on my open source stuff too ;)
I'll give it a shot today. Thanks.
I just tried this branch with the example I gave earlier, and it has the correct behavior now. Thanks!
Released as version 0.3.1
When you do this:
it treats it as though you did this