Merge branch 'mix-indexer' into 'develop'
Add additional flags to the Pleroma.Search.Indexer Mix task See merge request pleroma/pleroma!4131
This commit is contained in:
commit
b4332b47d5
1
changelog.d/mix-indexer.add
Normal file
1
changelog.d/mix-indexer.add
Normal file
@ -0,0 +1 @@
|
|||||||
|
Permit passing --chunk and --step values to the Pleroma.Search.Indexer Mix task
|
@ -33,15 +33,18 @@ defmodule Mix.Tasks.Pleroma.Search.Indexer do
|
|||||||
OptionParser.parse(
|
OptionParser.parse(
|
||||||
options,
|
options,
|
||||||
strict: [
|
strict: [
|
||||||
limit: :integer
|
chunk: :integer,
|
||||||
|
limit: :integer,
|
||||||
|
step: :integer
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
|
|
||||||
|
chunk_size = Keyword.get(options, :chunk, 100)
|
||||||
limit = Keyword.get(options, :limit, 100_000)
|
limit = Keyword.get(options, :limit, 100_000)
|
||||||
|
per_step = Keyword.get(options, :step, 1000)
|
||||||
|
|
||||||
per_step = 1000
|
|
||||||
chunks = max(div(limit, per_step), 1)
|
chunks = max(div(limit, per_step), 1)
|
||||||
|
|
||||||
1..chunks
|
1..chunks
|
||||||
@ -65,7 +68,7 @@ defmodule Mix.Tasks.Pleroma.Search.Indexer do
|
|||||||
IO.puts("Got #{length(ids)} activities, adding to indexer")
|
IO.puts("Got #{length(ids)} activities, adding to indexer")
|
||||||
|
|
||||||
ids
|
ids
|
||||||
|> Enum.chunk_every(100)
|
|> Enum.chunk_every(chunk_size)
|
||||||
|> Enum.each(fn chunk ->
|
|> Enum.each(fn chunk ->
|
||||||
IO.puts("Adding #{length(chunk)} activities to indexing queue")
|
IO.puts("Adding #{length(chunk)} activities to indexing queue")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user