Wednesday 15 October 2014

Link: schedule your sidetiq jobs for a specific timezone

Currently, "UTC" and "not UTC" are the only options available for scheduling your sidetiq workers...

Now, UTC is great if you're lucky enough to live in London - in which case, you can stop reading now. Or if all your systems happen to be set that way... though it doesn't let you accommodate local things such as daylight savings time-shifts.

So the only other option provided by sidetiq is "not UTC" which means you default to whatever timezone is set on your server... which is great if your server's local time is set to the timezone you actually live in... but, if, like most of us, your server is in an amazon cluster somewhere in Randomville America or somewhere on the sub-continent, you may not have that luxury either.

Then you need some way of making sure that your sidetiq workers run at 2am *for you*... instead during the middle of the midday-rush, slowing your servers to a crawl right when your users need you most...

Thankfully, here is a useful gist by toolmantim that lets you set the sidetiq time zone to whatever you'd like. eg it lets you do something like the following

  schedule_time_zone "Australia/Sydney"
  recurrence { daily.hour_of_day(2) }

No comments: