-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add every:
Proc support + until:
val + until:
Proc support
#25
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #25 +/- ##
==========================================
- Coverage 99.08% 98.74% -0.34%
==========================================
Files 83 83
Lines 2069 2149 +80
==========================================
+ Hits 2050 2122 +72
- Misses 19 27 +8
... and 3 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
I wonder if it makes sense to validate separate keys for periodical? subclass Drip? Spitballing here, not a prescription. |
I could totally see that. Actually the separation between |
I'll push it up in a sec; might need some help documenting it... hehe |
can you help with #26? i think once that's merged this might be more tenable? |
Yeah! |
one thing about this: keyword arg perhaps |
We'd have the same problem. The keyword issue is that we're passing the arg into a hash and it would look like this: def periodical(action_name, every:, start: -> { ::Caffeinate.config.time_now }, until: -> { 5_000.years.from_now }**options, &block)
options[:start] = start
options[:every] = every
options[:until] = until
drip(action_name, options, &block)
# etc. Even Github's Ruby parser marks the def periodical(action_name, every:, start: -> { ::Caffeinate.config.time_now }, **options, &block)
options[:start] = start
options[:every] = every
options[:until] ||= 5_000.years.from_now # can't call this out as a param above because `until` is a Ruby keyword
drip(action_name, options, &block)
# etc. But outside of Ruby language logistics (and the trouble that comes with either "Do this every X days, starting Y, until Z" or "Do this every X days, starting Y, if Z" |
I think between these two I'm still on team |
(perhaps do we want to merge #26 first? |
@joshmn any interest in this PR still? Happy to rebase; I think master still has a couple of hiccups / bugs around |
Note to self: I should come back to this, and maybe instead of having |
I don't think this PR is needed anymore. See extensive writeup at #41 |
Currently possible:
With somewhat-bug described here in that the
start
value is re-assessed with every period and causes driftBreaking Changes
start:
no longer drifts the periods, it's only used for the first message in the sequenceNow possible:
But we should be careful with the last one (static
until:
value) — setting anuntil:
with a computed date will get re-computed each time the Rails app process boots up! It's available for those that need it, but with caution! If it always gets recomputed, it'll never actually stop messaging 😛I'll need to update docs before this is ready as a PR.