X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fuploaders%2Fuploader.ex;h=c0b22c28a4cf7af16b37767f12b7fb2ff9808a6b;hb=1d46944fbd17d194d744230cd519d1410e821a47;hp=ce83cbbbc76584afdc0dc45de40e64b33f0cae2f;hpb=f9a326909979959d6cb43f66177045bb2adccbf4;p=akkoma diff --git a/lib/pleroma/uploaders/uploader.ex b/lib/pleroma/uploaders/uploader.ex index ce83cbbbc..c0b22c28a 100644 --- a/lib/pleroma/uploaders/uploader.ex +++ b/lib/pleroma/uploaders/uploader.ex @@ -3,6 +3,8 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Uploaders.Uploader do + import Pleroma.Web.Gettext + @moduledoc """ Defines the contract to put and get an uploaded file to any backend. """ @@ -29,7 +31,6 @@ defmodule Pleroma.Uploaders.Uploader do * `{:error, String.t}` error information if the file failed to be saved to the backend. * `:wait_callback` will wait for an http post request at `/api/pleroma/upload_callback/:upload_path` and call the uploader's `http_callback/3` method. - """ @type file_spec :: {:file | :url, String.t()} @callback put_file(Pleroma.Upload.t()) :: @@ -67,7 +68,14 @@ defmodule Pleroma.Uploaders.Uploader do {:error, error} end after - 30_000 -> {:error, "Uploader callback timeout"} + callback_timeout() -> {:error, dgettext("errors", "Uploader callback timeout")} + end + end + + defp callback_timeout do + case Mix.env() do + :test -> 1_000 + _ -> 30_000 end end end