From 0a5b22bc3b1a0011b83e1a77f4f58700266c260a Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Fri, 20 Nov 2020 11:37:01 +0300 Subject: [PATCH] start limiters in mix tasks --- lib/mix/pleroma.ex | 1 + lib/pleroma/application.ex | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/mix/pleroma.ex b/lib/mix/pleroma.ex index 3de11efce..6df1cf538 100644 --- a/lib/mix/pleroma.ex +++ b/lib/mix/pleroma.ex @@ -19,6 +19,7 @@ defmodule Mix.Pleroma do def start_pleroma do Pleroma.Config.Holder.save_default() Pleroma.Config.Oban.warn() + Pleroma.Application.limiters_setup() Application.put_env(:phoenix, :serve_endpoints, false, persistent: true) if Pleroma.Config.get(:env) != :test do diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index d3c32942c..ced14f87f 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -274,6 +274,7 @@ defp http_children(Tesla.Adapter.Gun, _) do defp http_children(_, _), do: [] + @spec limiters_setup() :: :ok def limiters_setup do [Pleroma.Web.RichMedia.Helpers, Pleroma.Web.MediaProxy] |> Enum.each(&ConcurrentLimiter.new(&1, 1, 0))