Use config to control streamer registry

This commit is contained in:
Mark Felder 2024-01-20 18:51:20 -05:00
parent 4bb57d4f25
commit 17877f612e
4 changed files with 20 additions and 15 deletions

View File

@ -80,7 +80,8 @@
config :pleroma, Pleroma.ReverseProxy.Client, Pleroma.ReverseProxy.ClientMock config :pleroma, Pleroma.ReverseProxy.Client, Pleroma.ReverseProxy.ClientMock
config :pleroma, Pleroma.Application, config :pleroma, Pleroma.Application,
background_migrators: false background_migrators: false,
streamer_registry: 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"

View File

@ -908,7 +908,8 @@
background_migrators: true, background_migrators: true,
internal_fetch: true, internal_fetch: true,
load_custom_modules: true, load_custom_modules: true,
max_restarts: 3 max_restarts: 3,
streamer_registry: true
# Import environment specific config. This must remain at the bottom # Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above. # of this file so it overrides the configuration defined above.

View File

@ -166,7 +166,8 @@
background_migrators: false, background_migrators: false,
internal_fetch: false, internal_fetch: false,
load_custom_modules: false, load_custom_modules: false,
max_restarts: 100 max_restarts: 100,
streamer_registry: false
if File.exists?("./config/test.secret.exs") do if File.exists?("./config/test.secret.exs") do
import_config "test.secret.exs" import_config "test.secret.exs"

View File

@ -107,7 +107,7 @@ def start(_type, _args) do
Pleroma.Web.Endpoint Pleroma.Web.Endpoint
] ++ ] ++
task_children() ++ task_children() ++
dont_run_in_test(@mix_env) ++ streamer_registry() ++
background_migrators() ++ background_migrators() ++
shout_child(shout_enabled?()) ++ shout_child(shout_enabled?()) ++
[Pleroma.Gopher.Server] [Pleroma.Gopher.Server]
@ -209,17 +209,19 @@ def build_cachex(type, opts),
defp shout_enabled?, do: Config.get([:shout, :enabled]) defp shout_enabled?, do: Config.get([:shout, :enabled])
defp dont_run_in_test(env) when env in [:test, :benchmark], do: [] defp streamer_registry() do
if Application.get_env(:pleroma, __MODULE__)[:streamer_registry] do
defp dont_run_in_test(_) do [
[ {Registry,
{Registry, [
[ name: Pleroma.Web.Streamer.registry(),
name: Pleroma.Web.Streamer.registry(), keys: :duplicate,
keys: :duplicate, partitions: System.schedulers_online()
partitions: System.schedulers_online() ]}
]} ]
] else
[]
end
end end
defp background_migrators do defp background_migrators do