Commit 195c0f585ad6b9b9a3f6a0dcc5a30d4caf01b8ef

Authored by Andrew Kane
1 parent 4a8315fb

Fixed error with reindex queue - fixes #1506

CHANGELOG.md
  1 +## 4.5.2 (unreleased)
  2 +
  3 +- Fixed error with reindex queue
  4 +
1 5 ## 4.5.1 (2021-08-03)
2 6  
3 7 - Improved performance of reindex queue
... ...
lib/searchkick/reindex_queue.rb
... ... @@ -15,7 +15,7 @@ module Searchkick
15 15 # TODO use reliable queuing
16 16 def reserve(limit: 1000)
17 17 if supports_rpop_with_count?
18   - Searchkick.with_redis { |r| r.call("rpop", redis_key, limit) }
  18 + Searchkick.with_redis { |r| r.call("rpop", redis_key, limit) }.to_a
19 19 else
20 20 record_ids = []
21 21 Searchkick.with_redis do |r|
... ...
test/reindex_test.rb
... ... @@ -198,6 +198,9 @@ class ReindexTest < Minitest::Test
198 198 Product.searchkick_index.refresh
199 199 assert_search "product", ["Product A", "Product C"], load: false
200 200 assert_equal 0, reindex_queue.length
  201 +
  202 + # ensure no error with empty queue
  203 + Searchkick::ProcessQueueJob.perform_later(class_name: "Product")
201 204 end
202 205  
203 206 def test_transaction
... ...