Use config to control background migrators

This commit is contained in:
Mark Felder 2024-01-20 18:47:25 -05:00
parent c7eda0b24a
commit 4bb57d4f25
4 changed files with 15 additions and 5 deletions

View file

@ -79,6 +79,9 @@ IO.puts("RUM enabled: #{rum_enabled}")
config :pleroma, Pleroma.ReverseProxy.Client, Pleroma.ReverseProxy.ClientMock config :pleroma, Pleroma.ReverseProxy.Client, Pleroma.ReverseProxy.ClientMock
config :pleroma, Pleroma.Application,
background_migrators: false
if File.exists?("./config/benchmark.secret.exs") do if File.exists?("./config/benchmark.secret.exs") do
import_config "benchmark.secret.exs" import_config "benchmark.secret.exs"
else else

View file

@ -905,6 +905,7 @@ config :pleroma, Pleroma.Search.Meilisearch,
initial_indexing_chunk_size: 100_000 initial_indexing_chunk_size: 100_000
config :pleroma, Pleroma.Application, config :pleroma, Pleroma.Application,
background_migrators: true,
internal_fetch: true, internal_fetch: true,
load_custom_modules: true, load_custom_modules: true,
max_restarts: 3 max_restarts: 3

View file

@ -163,6 +163,7 @@ peer_module =
config :pleroma, Pleroma.Cluster, peer_module: peer_module config :pleroma, Pleroma.Cluster, peer_module: peer_module
config :pleroma, Pleroma.Application, config :pleroma, Pleroma.Application,
background_migrators: false,
internal_fetch: false, internal_fetch: false,
load_custom_modules: false, load_custom_modules: false,
max_restarts: 100 max_restarts: 100

View file

@ -108,6 +108,7 @@ defmodule Pleroma.Application do
] ++ ] ++
task_children() ++ task_children() ++
dont_run_in_test(@mix_env) ++ dont_run_in_test(@mix_env) ++
background_migrators() ++
shout_child(shout_enabled?()) ++ shout_child(shout_enabled?()) ++
[Pleroma.Gopher.Server] [Pleroma.Gopher.Server]
@ -218,14 +219,18 @@ defmodule Pleroma.Application do
keys: :duplicate, keys: :duplicate,
partitions: System.schedulers_online() partitions: System.schedulers_online()
]} ]}
] ++ background_migrators() ]
end end
defp background_migrators do defp background_migrators do
if Application.get_env(:pleroma, __MODULE__)[:background_migrators] do
[ [
Pleroma.Migrators.HashtagsTableMigrator, Pleroma.Migrators.HashtagsTableMigrator,
Pleroma.Migrators.ContextObjectsDeletionMigrator Pleroma.Migrators.ContextObjectsDeletionMigrator
] ]
else
[]
end
end end
defp shout_child(true) do defp shout_child(true) do