X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fapplication.ex;h=5801e930dc91a01e91c0129a7fb0633af552f134;hb=99ced95d3bf4b49246e6946568cdd31b4173a25f;hp=b55d980e92787068523adbe07eca4861ad256cbd;hpb=364b6969eb7c79e57ed02345ddff4f48519e6b0a;p=akkoma diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index b55d980e9..5801e930d 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -47,7 +47,6 @@ defmodule Pleroma.Application do # Disable warnings_as_errors at runtime, it breaks Phoenix live reload # due to protocol consolidation warnings Code.compiler_options(warnings_as_errors: false) - Pleroma.Telemetry.Logger.attach() Config.Holder.save_default() Pleroma.HTML.compile_scrubbers() Pleroma.Config.Oban.warn() @@ -59,9 +58,6 @@ defmodule Pleroma.Application do Pleroma.Docs.JSON.compile() limiters_setup() - Logger.info("Starting Finch") - Finch.start_link(name: MyFinch) - # Define workers and child supervisors to be supervised children = [ @@ -71,6 +67,7 @@ defmodule Pleroma.Application do Pleroma.Web.Plugs.RateLimiter.Supervisor ] ++ cachex_children() ++ + http_children() ++ [ Pleroma.Stats, Pleroma.JobQueueMonitor, @@ -85,7 +82,17 @@ defmodule Pleroma.Application do # See http://elixir-lang.org/docs/stable/elixir/Supervisor.html # for other strategies and supported options - opts = [strategy: :one_for_one, name: Pleroma.Supervisor] + # If we have a lot of caches, default max_restarts can cause test + # resets to fail. + # Go for the default 3 unless we're in test + max_restarts = + if @mix_env == :test do + 100 + else + 3 + end + + opts = [strategy: :one_for_one, name: Pleroma.Supervisor, max_restarts: max_restarts] result = Supervisor.start_link(children, opts) set_postgres_server_version() @@ -277,4 +284,13 @@ defmodule Pleroma.Application do ConcurrentLimiter.new(module, max_running, max_waiting) end) end + + defp http_children do + config = + [:http, :adapter] + |> Config.get([]) + |> Keyword.put(:name, MyFinch) + + [{Finch, config}] + end end