X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fapplication.ex;h=d39451a9dcb8bf6b26fe018a8a2708e119b67295;hb=1b49b8efe57256b3f64b4b7e8a1de805ab030814;hp=e3edd05ca1b1744c6039ba4e1f346247a0768780;hpb=72aeb2e73b77611504e1cd524a9cb47faef6816f;p=akkoma diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index e3edd05ca..d39451a9d 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Application do @@ -104,7 +104,8 @@ defmodule Pleroma.Application do chat_child(chat_enabled?()) ++ [ Pleroma.Web.Endpoint, - Pleroma.Gopher.Server + Pleroma.Gopher.Server, + Pleroma.Migrators.HashtagsTableMigrator ] # See http://elixir-lang.org/docs/stable/elixir/Supervisor.html @@ -114,9 +115,6 @@ defmodule Pleroma.Application do set_postgres_server_version() - # Requires Config.TransferTask so ConfigDB values are loaded - steal_emoji_policy_setup() - result end @@ -300,23 +298,16 @@ defmodule Pleroma.Application do @spec limiters_setup() :: :ok def limiters_setup do - [Pleroma.Web.RichMedia.Helpers, Pleroma.Web.MediaProxy] - |> Enum.each(&ConcurrentLimiter.new(&1, 1, 0)) - end + config = Config.get(ConcurrentLimiter, []) - @spec steal_emoji_policy_setup() :: :ok - defp steal_emoji_policy_setup() do - with true <- - Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy in Config.get!([:mrf, :policies]) do - path = - [:instance, :static_dir] - |> Config.get!() - |> Path.join("emoji/steal") + [Pleroma.Web.RichMedia.Helpers, Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy] + |> Enum.each(fn module -> + mod_config = Keyword.get(config, module, []) - if !File.exists?(path), do: File.mkdir_p!(path) - else - _ -> - :ok - end + max_running = Keyword.get(mod_config, :max_running, 5) + max_waiting = Keyword.get(mod_config, :max_waiting, 5) + + ConcurrentLimiter.new(module, max_running, max_waiting) + end) end end