summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfeld <feld@feld.me>2024-05-29 15:04:58 +0000
committerfeld <feld@feld.me>2024-05-29 15:04:58 +0000
commitb4332b47d513c58587f6d43c8bf6a373b7489d67 (patch)
treef4b57240db1246af4cc6dc9c96662a0473c0db6c
parent3b639b467e8c57e3875b273359d63c014671302a (diff)
parent14b4bd69a83846b3c117624851b96b9fc30528bf (diff)
downloadpleroma-b4332b47d513c58587f6d43c8bf6a373b7489d67.tar.gz
pleroma-b4332b47d513c58587f6d43c8bf6a373b7489d67.zip
Merge branch 'mix-indexer' into 'develop'
Add additional flags to the Pleroma.Search.Indexer Mix task See merge request pleroma/pleroma!4131
-rw-r--r--changelog.d/mix-indexer.add1
-rw-r--r--lib/mix/tasks/pleroma/search/indexer.ex9
2 files changed, 7 insertions, 3 deletions
diff --git a/changelog.d/mix-indexer.add b/changelog.d/mix-indexer.add
new file mode 100644
index 000000000..6effb959b
--- /dev/null
+++ b/changelog.d/mix-indexer.add
@@ -0,0 +1 @@
+Permit passing --chunk and --step values to the Pleroma.Search.Indexer Mix task
diff --git a/lib/mix/tasks/pleroma/search/indexer.ex b/lib/mix/tasks/pleroma/search/indexer.ex
index 81a9fced6..2a52472f9 100644
--- a/lib/mix/tasks/pleroma/search/indexer.ex
+++ b/lib/mix/tasks/pleroma/search/indexer.ex
@@ -33,15 +33,18 @@ defmodule Mix.Tasks.Pleroma.Search.Indexer do
OptionParser.parse(
options,
strict: [
- limit: :integer
+ chunk: :integer,
+ limit: :integer,
+ step: :integer
]
)
start_pleroma()
+ chunk_size = Keyword.get(options, :chunk, 100)
limit = Keyword.get(options, :limit, 100_000)
+ per_step = Keyword.get(options, :step, 1000)
- per_step = 1000
chunks = max(div(limit, per_step), 1)
1..chunks
@@ -65,7 +68,7 @@ defmodule Mix.Tasks.Pleroma.Search.Indexer do
IO.puts("Got #{length(ids)} activities, adding to indexer")
ids
- |> Enum.chunk_every(100)
+ |> Enum.chunk_every(chunk_size)
|> Enum.each(fn chunk ->
IO.puts("Adding #{length(chunk)} activities to indexing queue")