Commit 0920d0cb212ff8cde7863ccdd1f6d3876e64b8d6
1 parent
b294478d
Exists in
index_name
Better inline
Showing
1 changed file
with
9 additions
and
4 deletions
Show diff stats
lib/searchkick/process_queue_job.rb
@@ -9,13 +9,18 @@ module Searchkick | @@ -9,13 +9,18 @@ module Searchkick | ||
9 | loop do | 9 | loop do |
10 | record_ids = model.searchkick_index(name: index_name).reindex_queue.reserve(limit: limit) | 10 | record_ids = model.searchkick_index(name: index_name).reindex_queue.reserve(limit: limit) |
11 | if record_ids.any? | 11 | if record_ids.any? |
12 | - perform_method = inline ? :perform_now : :perform_later | ||
13 | - Searchkick::ProcessBatchJob.send( | ||
14 | - perform_method, | 12 | + batch_options = { |
15 | class_name: class_name, | 13 | class_name: class_name, |
16 | record_ids: record_ids, | 14 | record_ids: record_ids, |
17 | index_name: index_name | 15 | index_name: index_name |
18 | - ) | 16 | + } |
17 | + | ||
18 | + if inline | ||
19 | + Searchkick::ProcessBatchJob.new.perform(**batch_options) | ||
20 | + else | ||
21 | + Searchkick::ProcessBatchJob.perform_later(**batch_options) | ||
22 | + end | ||
23 | + | ||
19 | # TODO when moving to reliable queuing, mark as complete | 24 | # TODO when moving to reliable queuing, mark as complete |
20 | end | 25 | end |
21 | break unless record_ids.size == limit | 26 | break unless record_ids.size == limit |