randomize minute, when just "every :hour" is given

106 views
Skip to first unread message

philister

unread,
Feb 27, 2015, 8:00:16 AM2/27/15
to whenev...@googlegroups.com
Hi,
if you have several task that should run "every :hour", it could be a good idea to randomize the exact minute each task is running. Of course that could be the same for "every :day" and others.
Is there a feature like that yet? Good idea? If so, I can imagine to implement it.

Thanks and Greetings, Phil

Tim Uckun

unread,
Feb 27, 2015, 5:55:11 PM2/27/15
to whenev...@googlegroups.com
I do think this would be a valuable feature.  If you have a server with 20 or 30 apps running on it and they all have cron jobs that fire once a day or once an hour or every five minutes then you end up slamming the server all at once.

So for any cron period it would be useful to specify a sub element as being random. For example if you are firing every five minutes it might be nice to say "fire at a random second" which might stagger the load a bit on the server.  Having said that I could see somebody wanting to put some constraints on it like "fire once an hour with a random minute but no later than five minutes after the hour".



--
--
You received this message because you are subscribed to the Google
Groups "Whenever Gem" group and because you're awesome.
To post to this group, send email to whenev...@googlegroups.com
To unsubscribe from this group, send email to
whenever-gem...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/whenever-gem?hl=en
---
You received this message because you are subscribed to the Google Groups "Whenever Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email to whenever-gem...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Philipp Albig

unread,
Mar 6, 2015, 5:02:07 AM3/6/15
to whenev...@googlegroups.com
This is the first shot. Feedback welcome.
https://github.com/philister/whenever

If you use the Symbol-Shortcut (:hour or :day at the moment) and leave the at-argument blank, the exact time of execution will be randomized


You received this message because you are subscribed to a topic in the Google Groups "Whenever Gem" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/whenever-gem/CL4SXPwGF-0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to whenever-gem...@googlegroups.com.

awe...@mdsol.com

unread,
Apr 29, 2016, 6:45:42 PM4/29/16
to Whenever Gem, philip...@gmail.com
Cool! Found this after posting my own randomization PR at https://github.com/javan/whenever/pull/615, that does the randomization at the seconds level (since apparently "top of the minute" is a thing). Your approach is compatible, though, maybe we could do both. Yours may work better for jobs like "every(:hour)," mine for more-frequently-running jobs or jobs with more specific schedules (since mine supports "every(:day, at: '3:00 am').and_about(20.minutes)").
Reply all
Reply to author
Forward
0 new messages