Class: Rekiq::Scheduler

Inherits:
Object
  • Object
show all
Defined in:
lib/rekiq/scheduler.rb

Instance Method Summary collapse

Constructor Details

#initialize(worker_name, queue, args, contract) ⇒ Scheduler

Returns a new instance of Scheduler.



3
4
5
6
7
8
# 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

Instance Method Details

#schedule_initial_work(from = Time.now) ⇒ Object



10
11
12
13
# 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) ⇒ Object



15
16
17
18
# 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