Sha256: f254695ba65423dd8625c2cba7e86df4bb95d4bdeaf7a27ed9f00332ec7d3d48
Contents?: true
Size: 646 Bytes
Versions: 34
Compression:
Stored size: 646 Bytes
Contents
module Workarea class KeepProductIndexFresh include Sidekiq::Worker sidekiq_options( lock: :until_executing, retry: false ) def perform(*args) all = never_indexed + stale all.take(Workarea.config.stale_products_size).each do |product| IndexProduct.perform(product) end end def never_indexed Catalog::Product .where(last_indexed_at: nil) .limit(Workarea.config.stale_products_size) .to_a end def stale Catalog::Product .asc(:last_indexed_at) .limit(Workarea.config.stale_products_size) .to_a end end end
Version data entries
34 entries across 34 versions & 1 rubygems