Sha256: 8690855fef339853d1490f8ee996dd2896d5ce7a771fe47f1b395049ca1ddfaf
Contents?: true
Size: 641 Bytes
Versions: 28
Compression:
Stored size: 641 Bytes
Contents
module Workarea class KeepProductIndexFresh include Sidekiq::Worker sidekiq_options( lock: :until_executing, retry: false, query_cache: true ) def perform(*args) all = never_indexed + stale BulkIndexProducts.perform_by_models(all.take(Workarea.config.stale_products_size)) 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
28 entries across 28 versions & 1 rubygems