FIX: sidekiq 100% CPU usage due to ice_cube

This commit is contained in:
Robin Ward 2014-01-10 11:43:24 -05:00
parent 888060d5d9
commit 1aee217a61
2 changed files with 17 additions and 1 deletions

View File

@ -6,7 +6,7 @@ require_dependency 'email/receiver'
module Jobs
class PollMailbox < Jobs::Scheduled
recurrence { minutely(5) }
recurrence { hourly.minute_of_hour(0,5,10,15,20,25,30,35,40,45,50,55) }
sidekiq_options retry: false
def execute(args)

View File

@ -0,0 +1,16 @@
module IceCube
class MinutelyRule < ValidatedRule
def initialize(interval = 1, week_start = :sunday)
super
unless interval == 1
raise "Due to a gigantic awful bug in ice_cube, don't specify an interval for minutely. Use `hourly.minute_of_hour`"
end
interval(interval)
schedule_lock(:sec)
reset
end
end
end