diff --git a/config/config.exs b/config/config.exs index 7ff3aaa22..bb17ab145 100644 --- a/config/config.exs +++ b/config/config.exs @@ -911,6 +911,8 @@ max_restarts: 3, streamer_registry: true +config :pleroma, Pleroma.Uploaders.Uploader, timeout: 30_000 + # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. import_config "#{Mix.env()}.exs" diff --git a/config/test.exs b/config/test.exs index 28d0364c6..40e93705d 100644 --- a/config/test.exs +++ b/config/test.exs @@ -170,6 +170,8 @@ streamer_registry: false, test_http_pools: true +config :pleroma, Pleroma.Uploaders.Uploader, timeout: 1_000 + if File.exists?("./config/test.secret.exs") do import_config "test.secret.exs" else diff --git a/lib/pleroma/uploaders/uploader.ex b/lib/pleroma/uploaders/uploader.ex index 23caaff1a..3396fe06a 100644 --- a/lib/pleroma/uploaders/uploader.ex +++ b/lib/pleroma/uploaders/uploader.ex @@ -5,8 +5,6 @@ defmodule Pleroma.Uploaders.Uploader do import Pleroma.Web.Gettext - @mix_env Mix.env() - @moduledoc """ Defines the contract to put and get an uploaded file to any backend. """ @@ -75,10 +73,5 @@ defp handle_callback(uploader, upload) do end end - defp callback_timeout do - case @mix_env do - :test -> 1_000 - _ -> 30_000 - end - end + defp callback_timeout, do: Application.get_env(:pleroma, __MODULE__)[:timeout] end