diff --git a/CHANGELOG.md b/CHANGELOG.md index 030b58a..ef7245d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 4.5.2 (unreleased) + +- Fixed error with reindex queue + ## 4.5.1 (2021-08-03) - Improved performance of reindex queue diff --git a/lib/searchkick/reindex_queue.rb b/lib/searchkick/reindex_queue.rb index 22511b9..86a8917 100644 --- a/lib/searchkick/reindex_queue.rb +++ b/lib/searchkick/reindex_queue.rb @@ -15,7 +15,7 @@ module Searchkick # TODO use reliable queuing def reserve(limit: 1000) if supports_rpop_with_count? - Searchkick.with_redis { |r| r.call("rpop", redis_key, limit) } + Searchkick.with_redis { |r| r.call("rpop", redis_key, limit) }.to_a else record_ids = [] Searchkick.with_redis do |r| diff --git a/test/reindex_test.rb b/test/reindex_test.rb index bd22bb6..7f8f299 100644 --- a/test/reindex_test.rb +++ b/test/reindex_test.rb @@ -198,6 +198,9 @@ class ReindexTest < Minitest::Test Product.searchkick_index.refresh assert_search "product", ["Product A", "Product C"], load: false assert_equal 0, reindex_queue.length + + # ensure no error with empty queue + Searchkick::ProcessQueueJob.perform_later(class_name: "Product") end def test_transaction -- libgit2 0.21.0