Class: Executo::SchedulerWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
lib/executo/scheduler_worker.rb

Instance Method Summary collapse

Instance Method Details

#performObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/executo/scheduler_worker.rb', line 10

def perform
  execution_time = Time.now.utc
  execution_time -= execution_time.sec

  self.class.perform_at(execution_time + 60) unless scheduled?

  # SCHEDULE.each do |(worker_class, schedule_lambda)|
  #   worker_class.perform_async if !scheduled?(worker_class) && schedule_lambda.call(execution_time)
  # end
end

#scheduled?(worker_class = self.class) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/executo/scheduler_worker.rb', line 21

def scheduled?(worker_class = self.class)
  scheduled_workers[worker_class.name]
end