Hourly on Specific Minute
If I wanted a recurrence that is every day at 8 I can do this:
> puts Montrose.daily(hour: 8).take(10)
2025-03-28 08:53:34 -0400
2025-03-29 08:53:34 -0400
2025-03-30 08:53:34 -0400
2025-03-31 08:53:34 -0400
2025-04-01 08:53:34 -0400
2025-04-02 08:53:34 -0400
2025-04-03 08:53:34 -0400
2025-04-04 08:53:34 -0400
2025-04-05 08:53:34 -0400
2025-04-06 08:53:34 -0400
I can even make it exactly on the hour by using the minute: 0 (although not exactly on the 0 sec):
> puts Montrose.daily(hour: 8, minute: 0).take(10)
2025-03-28 08:00:12 -0400
2025-03-29 08:00:12 -0400
2025-03-30 08:00:12 -0400
2025-03-31 08:00:12 -0400
2025-04-01 08:00:12 -0400
2025-04-02 08:00:12 -0400
2025-04-03 08:00:12 -0400
2025-04-04 08:00:12 -0400
2025-04-05 08:00:12 -0400
2025-04-06 08:00:12 -0400
But if I want to go one notch down in period and instead of daily at a certain hour do hourly at a certain minute:
puts Montrose.hourly(minute: 8).take(10)
This is accepted but it is caught in an infinate loop. Now I can work around this by indicating a start option that starts me on the 8th minute:
> puts Montrose.hourly(minute: 8, starts: Time.current.change(min: 8) + 1.hour).take(10)
2025-03-27 17:08:00 -0400
2025-03-27 18:08:00 -0400
2025-03-27 19:08:00 -0400
2025-03-27 20:08:00 -0400
2025-03-27 21:08:00 -0400
2025-03-27 22:08:00 -0400
2025-03-27 23:08:00 -0400
2025-03-28 00:08:00 -0400
2025-03-28 01:08:00 -0400
2025-03-28 02:08:00 -0400
But it seems I shouldn't have to specify the start time since I didn't have to do that for a certain hour every day.
Maybe I should be doing:
> puts Montrose.minutely(minute: 8).take(10)
2025-03-27 17:08:53 -0400
2025-03-27 18:08:53 -0400
2025-03-27 19:08:53 -0400
2025-03-27 20:08:53 -0400
2025-03-27 21:08:53 -0400
2025-03-27 22:08:53 -0400
2025-03-27 23:08:53 -0400
2025-03-28 00:08:53 -0400
2025-03-28 01:08:53 -0400
2025-03-28 02:08:53 -0400
But then that implies that really to do daily on a certain hour I should do:
> puts Montrose.hourly(hour: 8).take(10)
2025-03-28 08:04:44 -0400
2025-03-29 08:04:44 -0400
2025-03-30 08:04:44 -0400
2025-03-31 08:04:44 -0400
2025-04-01 08:04:44 -0400
2025-04-02 08:04:44 -0400
2025-04-03 08:04:44 -0400
2025-04-04 08:04:44 -0400
2025-04-05 08:04:44 -0400
2025-04-06 08:04:44 -0400
So that does work. But now if I want it right on the hour I can't add min: 0 or I get the infinite loop again:
puts Montrose.hourly(hour: 8, minute: 0).take(10)