Sha256: f4f1cf25293f3e54756c9ec97e3ac8043f82adaedf457ece6c26646f3e6aa716
Contents?: true
Size: 689 Bytes
Versions: 2
Compression:
Stored size: 689 Bytes
Contents
module Searchkick class ProcessQueueJob < ActiveJob::Base queue_as :searchkick def perform(class_name:) model = class_name.constantize limit = model.searchkick_index.options[:batch_size] || 1000 record_ids = Searchkick::ReindexQueue.new(model.searchkick_index.name).reserve(limit: limit) if record_ids.any? Searchkick::ProcessBatchJob.perform_later( class_name: model.name, record_ids: record_ids ) # TODO when moving to reliable queuing, mark as complete if record_ids.size == limit Searchkick::ProcessQueueJob.perform_later(class_name: class_name) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
searchkick-2.1.1 | lib/searchkick/process_queue_job.rb |
searchkick-2.1.0 | lib/searchkick/process_queue_job.rb |