Class: DeliveryShipConfirmWorker
- Inherits:
-
Object
- Object
- DeliveryShipConfirmWorker
- Includes:
- Sidekiq::Job
- Defined in:
- app/workers/delivery_ship_confirm_worker.rb
Overview
Sidekiq worker: delivery ship confirm.
Class Method Summary collapse
-
.lock_args(args) ⇒ Array
Extract delivery_id for unique lock key.
Instance Method Summary collapse
Class Method Details
.lock_args(args) ⇒ Array
Note:
NormalizeArgsMiddleware ensures args are string-keyed before lock computation
Extract delivery_id for unique lock key
20 21 22 23 |
# File 'app/workers/delivery_ship_confirm_worker.rb', line 20 def self.lock_args(args) = args.first || {} [['delivery_id']] end |
Instance Method Details
#perform(options = {}) ⇒ Object
Note:
NormalizeArgsMiddleware converts to HashWithIndifferentAccess
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/workers/delivery_ship_confirm_worker.rb', line 28 def perform( = {}) delivery_id = [:delivery_id] @job_name = "Ship confirm for delivery id: #{delivery_id}" delivery = Delivery.find(delivery_id) if delivery.pending_ship_confirm? logger.info 'Delivery is pending ship confirm, calling delivery.individual_auto_ship_confirm' delivery.individual_auto_ship_confirm logger.info 'Finished auto ship confirm' else logger.info 'Delivery is not in ship confirm' end end |