class Rekiq::Scheduler
Public Class Methods
new(worker_name, queue, args, contract)
click to toggle source
# File lib/rekiq/scheduler.rb, line 3 def initialize(worker_name, queue, args, contract) @worker_name = worker_name @queue = queue @args = args @contract = contract end
Public Instance Methods
schedule_initial_work(from = Time.now)
click to toggle source
# File lib/rekiq/scheduler.rb, line 10 def schedule_initial_work(from = Time.now) @work_time = @contract.initial_work_time(from) schedule_work end
schedule_next_work(previous_work_time)
click to toggle source
# File lib/rekiq/scheduler.rb, line 15 def schedule_next_work(previous_work_time) @work_time = @contract.next_work_time(previous_work_time) schedule_work end
Protected Instance Methods
push_to_redis()
click to toggle source
# File lib/rekiq/scheduler.rb, line 26 def push_to_redis Sidekiq::Client .push 'at' => @work_time.to_f, 'queue' => @queue, 'class' => @worker_name, 'args' => @args, 'rq:ctr' => @contract.to_hash, 'rq:sdl' => nil, 'rq:at' => @work_time.to_f # this needs to be here because the key 'at' is removed by sidekiq end
schedule_work()
click to toggle source
# File lib/rekiq/scheduler.rb, line 22 def schedule_work @work_time.nil? ? nil : [push_to_redis, @work_time] end