Class: Launchpad::IEO::SaleFinishWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
app/workers/launchpad/ieo/sale_finish_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_finish_worker.rb', line 8

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

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