Class: BatchItemAttributeWorker

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

Overview

Processes a batch of item IDs in a single job, loading PL/PC associations
once for the group rather than per-item.

Constant Summary collapse

BATCH_SIZE =
25

Instance Method Summary collapse

Instance Method Details

#perform(item_ids) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'app/workers/batch_item_attribute_worker.rb', line 11

def perform(item_ids)
  items = Item.where(id: item_ids)
              .includes(:primary_product_line, :product_category, :product_lines)

  items.each do |item|
    item.update_rendered_product_specifications
  rescue StandardError => e
    logger.error("BatchItemAttributeWorker failed for item #{item.id}: #{e.message}")
    ErrorReporting.error(e, { item_id: item.id })
  end
end