X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fapplication.ex;h=2ff7562e24d5f89e28e1a8a58be1a04139da928f;hb=8f88a90ca3f2f2c7c341126f6816db9667664ea7;hp=a1655721ad892868289c5cf5e8ab527e09879285;hpb=77e39e6aae0852df13b9576a081f30da13d7ec5b;p=akkoma
diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex
index a1655721a..2ff7562e2 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
@@ -14,7 +14,7 @@ defmodule Pleroma.Application do
@name Mix.Project.config()[:name]
@version Mix.Project.config()[:version]
@repository Mix.Project.config()[:source_url]
- @env Mix.env()
+ @mix_env Mix.env()
def name, do: @name
def version, do: @version
@@ -92,18 +92,19 @@ defmodule Pleroma.Application do
Pleroma.Web.Plugs.RateLimiter.Supervisor
] ++
cachex_children() ++
- http_children(adapter, @env) ++
+ http_children(adapter, @mix_env) ++
[
Pleroma.Stats,
Pleroma.JobQueueMonitor,
{Majic.Pool, [name: Pleroma.MajicPool, pool_size: Config.get([:majic_pool, :size], 2)]},
- {Oban, Config.get(Oban)}
+ {Oban, Config.get(Oban)},
+ Pleroma.Web.Endpoint
] ++
- task_children(@env) ++
- dont_run_in_test(@env) ++
+ task_children(@mix_env) ++
+ dont_run_in_test(@mix_env) ++
chat_child(chat_enabled?()) ++
[
- Pleroma.Web.Endpoint,
+ Pleroma.Migrators.HashtagsTableMigrator,
Pleroma.Gopher.Server
]
@@ -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
@@ -148,7 +146,7 @@ defmodule Pleroma.Application do
raise "Invalid custom modules"
{:ok, modules, _warnings} ->
- if @env != :test do
+ if @mix_env != :test do
Enum.each(modules, fn mod ->
Logger.info("Custom module loaded: #{inspect(mod)}")
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
- def 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