5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/searchkick/process_queue_job.rb', line 5
def perform(class_name:)
model = class_name.constantize
limit = model.searchkick_index.options[:batch_size] || 1000
record_ids = model.searchkick_index.reindex_queue.reserve(limit: limit)
if record_ids.any?
Searchkick::ProcessBatchJob.perform_later(
class_name: model.name,
record_ids: record_ids
)
if record_ids.size == limit
Searchkick::ProcessQueueJob.perform_later(class_name: class_name)
end
end
end
|