Class: ItemAttributeRefreshWorker
- Inherits:
-
Object
- Object
- ItemAttributeRefreshWorker
- Includes:
- Sidekiq::Job
- Defined in:
- app/workers/item_attribute_refresh_worker.rb
Overview
Sidekiq worker: item attribute refresh.
Instance Method Summary collapse
-
#perform ⇒ Object
Runs the job.
Instance Method Details
#perform ⇒ Object
Runs the job.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/workers/item_attribute_refresh_worker.rb', line 12 def perform # Periodically find items who had their specs not refreshed in a while e.g 14 days, do 500 at a time item_ids = Item.active.non_publications .where(rendered_product_specifications_at: [..14.days.ago, nil]) .order(:is_kit, :rendered_product_specifications_at) .limit(500) .ids item_ids.each_slice(BatchItemAttributeWorker::BATCH_SIZE) do |batch| BatchItemAttributeWorker.perform_async(batch) end end |