forked from AkkomaGang/akkoma
Merge branch 'feat/warn-large-pool-size' into 'develop'
Add a startup error for modified Repo pool_size See merge request pleroma/pleroma!3190
This commit is contained in:
commit
e73d878b38
2 changed files with 44 additions and 0 deletions
|
@ -24,6 +24,7 @@ def verify! 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,30 @@ defp check_system_commands!(:ok) 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.
|
||||||
|
|
||||||
|
Please revert or ensure your database is tuned appropriately and then set
|
||||||
|
`config :pleroma, :dangerzone, override_repo_pool_size: true`.
|
||||||
|
|
||||||
|
If you are experiencing database timeouts, please check the "Optimizing
|
||||||
|
your PostgreSQL performance" section in the documentation. If you still
|
||||||
|
encounter issues after that, please open an issue on the tracker.
|
||||||
|
""")
|
||||||
|
|
||||||
|
{:error, "Repo.pool_size different than 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])
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,25 @@ defmodule Pleroma.ApplicationRequirementsTest do
|
||||||
alias Pleroma.Config
|
alias Pleroma.Config
|
||||||
alias Pleroma.Repo
|
alias Pleroma.Repo
|
||||||
|
|
||||||
|
describe "check_repo_pool_size!/1" do
|
||||||
|
test "raises if the pool size is unexpected" do
|
||||||
|
clear_config([Pleroma.Repo, :pool_size], 11)
|
||||||
|
|
||||||
|
assert_raise Pleroma.ApplicationRequirements.VerifyError,
|
||||||
|
"Repo.pool_size different than recommended value.",
|
||||||
|
fn ->
|
||||||
|
capture_log(&Pleroma.ApplicationRequirements.verify!/0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
test "doesn't raise if the pool size is unexpected but the respective flag is set" do
|
||||||
|
clear_config([Pleroma.Repo, :pool_size], 11)
|
||||||
|
clear_config([:dangerzone, :override_repo_pool_size], true)
|
||||||
|
|
||||||
|
assert Pleroma.ApplicationRequirements.verify!() == :ok
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "check_welcome_message_config!/1" do
|
describe "check_welcome_message_config!/1" do
|
||||||
setup do: clear_config([:welcome])
|
setup do: clear_config([:welcome])
|
||||||
setup do: clear_config([Pleroma.Emails.Mailer])
|
setup do: clear_config([Pleroma.Emails.Mailer])
|
||||||
|
|
Loading…
Reference in a new issue