Sha256: 68c63b4a4a65f30c5b2fff60007b3d0b39475be3b9ab0392316086331d49ffff
Contents?: true
Size: 666 Bytes
Versions: 19
Compression:
Stored size: 666 Bytes
Contents
module Workarea class BulkIndexProducts include Sidekiq::Worker sidekiq_options lock: :until_executing class << self def perform(ids = Catalog::Product.pluck(:id)) ids.each_slice(100) do |group| perform_by_models(Catalog::Product.in(id: group).to_a) end end def perform_by_models(products) return if products.blank? documents = Search::ProductEntries.new(products).map(&:as_bulk_document) Search::Storefront.bulk(documents) products.each { |p| p.set(last_indexed_at: Time.current) } end end def perform(ids) self.class.perform(ids) end end end
Version data entries
19 entries across 19 versions & 1 rubygems