6

I've set up parallel re-indexing of an index.

Product.reindex(async: {wait: true})

I am running that code in a DelayedJob and waiting since it seems the alternative would be to periodically check on completion status and then promote the new index -- this seems simpler.

Confusingly, reindex never seems to complete. Despite the fact that I've tested it on an index with a single document, I continue to see log messages of "Batches left: 1".

I expect I am misunderstanding the documentation.

Ben
  • 15,010
  • 11
  • 58
  • 90
  • From [what I can see](https://github.com/ankane/searchkick/blob/0fed3037e9d6b58fb11bc5075898741784696d91/lib/searchkick/index.rb#L303-L308), setting `wait: true` implies that the process implements the waiting by itself and periodically checks the status. So you don't need to do it yourself. Reindexing may take a long time depending on the size of your index, though. – Val Mar 29 '18 at 04:10

1 Answers1

1

There was a race condition in the code that could cause this. It's fixed in Searchkick 3.0.3+. Here's the relevant commit.

Andrew Kane
  • 3,200
  • 19
  • 40