Add a startup error for modified Repo pool_size

This commit is contained in:
Mark Felder 2020-12-07 16:36:44 -06:00
parent ed76323776
commit fb3fd692c6

View file

@ -24,6 +24,7 @@ defmodule Pleroma.ApplicationRequirements do
|> check_migrations_applied!() |> check_migrations_applied!()
|> check_welcome_message_config!() |> check_welcome_message_config!()
|> check_rum!() |> check_rum!()
|> check_repo_pool_size!()
|> handle_result() |> handle_result()
end end
@ -188,6 +189,24 @@ defmodule Pleroma.ApplicationRequirements do
defp check_system_commands!(result), do: result defp check_system_commands!(result), do: result
defp check_repo_pool_size!(:ok) do
if Pleroma.Config.get([Pleroma.Repo, :pool_size], 10) != 10 and
not Pleroma.Config.get([:dangerzone, :override_repo_pool_size], false) do
Logger.error("""
!!!CONFIG WARNING!!!
The database pool size has been altered from the recommended value of 10.\n
Please revert or ensure your database is tuned appropriately and then set\n
`config :pleroma, :dangerzone, override_repo_pool_size: true`.
""")
{:error, "Repo.pool_size above recommended value."}
else
:ok
end
end
defp check_repo_pool_size!(result), do: result
defp check_filter(filter, command_required) do defp check_filter(filter, command_required) do
filters = Config.get([Pleroma.Upload, :filters]) filters = Config.get([Pleroma.Upload, :filters])