Mandatory at option #54

Open
opened 2025-12-29 00:22:01 +01:00 by adam · 0 comments
Owner

Originally created by @charlie-wasp on GitHub (Nov 29, 2017).

Hi there, and thank you for the great work with this gem! I've got an idea, how we can make it even better.

It seems that at the moment crono does not provide any strict default value for at option in period setting. This fact leads to situations like this:

> period = Crono::Period.new(1.month)
=> #<Crono::Period:0x00007fbc63404170 @period=1 month>
> period.next
=> 2017-12-29 10:50:26 +0600
> period.next
=> 2017-12-29 10:50:34 +0600

So next is shifting according to the time of invocation. It can cause confusing situation, when your monthly (for example) task will never be performed, if you deploy (and hence restart) your app more frequently, than once in a month. Actually, me and my colleagues hit that :)

So my proposal is to make at option mandatory, or provide some sensible default (midnight maybe?) to avoid such confusion?

What do you think about it?

Originally created by @charlie-wasp on GitHub (Nov 29, 2017). Hi there, and thank you for the great work with this gem! I've got an idea, how we can make it even better. It seems that at the moment crono does not provide any strict default value for `at` option in period setting. This fact leads to situations like this: ``` > period = Crono::Period.new(1.month) => #<Crono::Period:0x00007fbc63404170 @period=1 month> > period.next => 2017-12-29 10:50:26 +0600 > period.next => 2017-12-29 10:50:34 +0600 ``` So `next` is shifting according to the time of invocation. It can cause confusing situation, when your monthly (for example) task will never be performed, if you deploy (and hence restart) your app more frequently, than once in a month. Actually, me and my colleagues hit that :) So my proposal is to make `at` option mandatory, or provide some sensible default (midnight maybe?) to avoid such confusion? What do you think about it?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/crono#54