If you are using Sidetiq to set recurrence to schedule background jobs, then you may want to be aware of this known and reported issue with recurrence
. BTW, recurrence schedule is done using ice_cube gem
This is likely an issue in Ruby 1.9.3 but I have posted comments on this article here along with git issue to clarify if its an issue with Ruby 2.0 and above. References at the bottom of this email.
Issues: We generally set recurrence daily
or hourly
in our app/workers/job_name.rb
like this
recurrence do
daily
end
recurrence do
hourly(2)
end
Sidetiq WiKi says:
Unfortunately, using ice_cube's interval methods is terribly slow on start-up (it tends to eat up 100% CPU for quite a while) and on every recurrence run. This is due to it calculating every possible occurrence since the schedule's start time. The way around is to avoid using them. See this example
class MyWorker
include Sidekiq::Worker
include Sidetiq::Schedulable
recurrence { minutely(15) }
end
It is better to use the more explicit way:
class MyWorker
include Sidekiq::Worker
include Sidetiq::Schedulable
recurrence { hourly.minute_of_hour(0, 15, 30, 45) }
end
References:
http://stackoverflow.com/questions/20936305/sidekiq-sidetiq-recurrence-every-2-hours