Commit f691a1bae83fded0a2873add420bd322ffb65742
1 parent
fb9d24ae
Exists in
master
and in
18 other branches
Fixed reindex_status error - closes #1112
Showing
3 changed files
with
9 additions
and
4 deletions
Show diff stats
CHANGELOG.md
lib/searchkick/bulk_indexer.rb
@@ -51,6 +51,10 @@ module Searchkick | @@ -51,6 +51,10 @@ module Searchkick | ||
51 | Searchkick.indexer.queue(records.map { |r| RecordData.new(index, r).update_data(method_name) }) | 51 | Searchkick.indexer.queue(records.map { |r| RecordData.new(index, r).update_data(method_name) }) |
52 | end | 52 | end |
53 | 53 | ||
54 | + def batches_left | ||
55 | + Searchkick.with_redis { |r| r.scard(batches_key) } | ||
56 | + end | ||
57 | + | ||
54 | private | 58 | private |
55 | 59 | ||
56 | def import_or_update(records, method_name, async) | 60 | def import_or_update(records, method_name, async) |
@@ -156,10 +160,6 @@ module Searchkick | @@ -156,10 +160,6 @@ module Searchkick | ||
156 | end | 160 | end |
157 | end | 161 | end |
158 | 162 | ||
159 | - def batches_left | ||
160 | - Searchkick.with_redis { |r| r.scard(batches_key) } | ||
161 | - end | ||
162 | - | ||
163 | def batches_key | 163 | def batches_key |
164 | "searchkick:reindex:#{index.name}:batches" | 164 | "searchkick:reindex:#{index.name}:batches" |
165 | end | 165 | end |
test/reindex_test.rb
@@ -40,6 +40,10 @@ class ReindexTest < Minitest::Test | @@ -40,6 +40,10 @@ class ReindexTest < Minitest::Test | ||
40 | index.refresh | 40 | index.refresh |
41 | assert_equal 1, index.total_docs | 41 | assert_equal 1, index.total_docs |
42 | 42 | ||
43 | + if defined?(Redis) | ||
44 | + assert Searchkick.reindex_status(reindex[:name]) | ||
45 | + end | ||
46 | + | ||
43 | Product.searchkick_index.promote(reindex[:index_name]) | 47 | Product.searchkick_index.promote(reindex[:index_name]) |
44 | assert_search "product", ["Product A"] | 48 | assert_search "product", ["Product A"] |
45 | end | 49 | end |