caffeinate icon indicating copy to clipboard operation
caffeinate copied to clipboard

Periodical support and jitter

Open joshmn opened this issue 1 year ago • 8 comments

Discussion continued from https://github.com/joshmn/caffeinate/issues/21#issuecomment-1511365139

This is an interesting use case I didn't quite fully think through!

I wonder if it would make sense to support something like:

drip :random_long_term, mailer: ClientMailer, periodical: true, at: :set_time 

def set_time
  index = subscriber.mailings.sent.count 
  subscriber.morning_delivery((index * 2).weeks.from_now + rand(0..2).days) + rand(0..180).minutes 
end

I can't quite remember where/how periodical determines time. It's poorly documented (if that) because I haven't quite used it yet myself... hehe. It could also probably be reworked to hook into the callbacks as well if it's not already.

@jon-sully thoughts?

joshmn avatar Apr 17 '23 13:04 joshmn