Partial revert of 6ef5354 (parallel reindex op)

This commit is contained in:
Liam 2024-12-19 15:39:51 -05:00
parent b4f86ff2db
commit f2fb46805a

View file

@ -203,8 +203,9 @@ defmodule PhilomenaQuery.Search do
def reindex(queryable, module, opts \\ []) do
index = @policy.index_for(module)
process =
fn records ->
queryable
|> Batch.record_batches(opts)
|> Enum.each(fn records ->
lines =
Enum.flat_map(records, fn record ->
doc = index.as_json(record)
@ -216,12 +217,7 @@ defmodule PhilomenaQuery.Search do
end)
Api.bulk(@policy.opensearch_url(), lines)
end
queryable
|> Batch.record_batches(opts)
|> Task.async_stream(process, ordered: false, timeout: :infinity)
|> Stream.run()
end)
end
@doc ~S"""