Class: AwaitingQualityControlPlansWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Job
Defined in:
app/workers/awaiting_quality_control_plans_worker.rb

Overview

Sidekiq worker: awaiting quality control plans.

Instance Method Summary collapse

Instance Method Details

#performObject

Biz time is defined per thread so we have to use a global var



9
10
11
12
13
14
# File 'app/workers/awaiting_quality_control_plans_worker.rb', line 9

def perform
  return unless Time.current.in_working_hours? # Only run during business hours.

  rcs = RoomConfiguration.where(state: 'awaiting_quality_control').where('updated_at < (?)', 15.minutes.ago)
  TrainingMailer.plans_ready_to_be_relased(rcs).deliver_now if rcs.present?
end