Class: ProductSpecsWorker

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

Instance Method Summary collapse

Instance Method Details

#perform(product_specification_ids) ⇒ Object

Takes one or multiple specs, find all affected items but only once, then queue ItemAttributeWorker for each item

Parameters:

  • product_specification_ids (Array<Integer>)


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

def perform(product_specification_ids)
  product_specification_ids = [product_specification_ids].flatten.compact.uniq

  affected_item_ids = batch_affected_item_ids(product_specification_ids)
  affected_item_ids.each { |iid| ItemAttributeWorker.perform_async(iid) }
end