Class: AwaitingQualityControlPlansWorker

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

Instance Method Summary collapse

Instance Method Details

#performObject

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



7
8
9
10
11
12
# File 'app/workers/awaiting_quality_control_plans_worker.rb', line 7

def perform
  if Time.current.in_working_hours? # Only run during business hours.
    rcs = RoomConfiguration.where(state: 'awaiting_quality_control').where('updated_at < (?)', 15.minutes.ago)
    InternalMailer.plans_ready_to_be_relased(rcs).deliver_now if rcs.present?
  end
end