Class: Launchpad::IEO::SaleStartWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
app/workers/launchpad/ieo/sale_start_worker.rb

Overview

TODO: Add logging to all workers.

Instance Method Summary collapse

Instance Method Details

#perform(sgid) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'app/workers/launchpad/ieo/sale_start_worker.rb', line 8

def perform(sgid)
  sale = GlobalID::Locator.locate_signed(sgid, for: 'sale_start')

  sale.start!
  Rails.logger.info { "Starting #{sale.id} sale" }
rescue AASM::InvalidTransition => e
  # TODO: Improve logging using Tagged Logger.
  Rails.logger.error sale_id: sale.id,
                    message: 'Failed to start',
                    error: e.message
end