[#2497] Func defs grouping fix.

This commit is contained in:
Ivan Tashkinov 2020-09-05 20:23:18 +03:00
parent f170d47130
commit 88a6ee4a59

View File

@ -16,6 +16,14 @@ defmodule Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy do
pool: :media pool: :media
] ]
defp adapter_options do
if Application.get_env(:tesla, :adapter) == Tesla.Adapter.Hackney do
Keyword.put(@adapter_options, :recv_timeout, 10_000)
else
@adapter_options
end
end
def perform(:prefetch, url) do def perform(:prefetch, url) do
# Fetching only proxiable resources # Fetching only proxiable resources
if MediaProxy.enabled?() and MediaProxy.url_proxiable?(url) do if MediaProxy.enabled?() and MediaProxy.url_proxiable?(url) do
@ -28,14 +36,6 @@ defmodule Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy do
end end
end end
defp adapter_options do
if Application.get_env(:tesla, :adapter) == Tesla.Adapter.Hackney do
Keyword.put(@adapter_options, :recv_timeout, 10_000)
else
@adapter_options
end
end
def perform(:preload, %{"object" => %{"attachment" => attachments}} = _message) do def perform(:preload, %{"object" => %{"attachment" => attachments}} = _message) do
Enum.each(attachments, fn Enum.each(attachments, fn
%{"url" => url} when is_list(url) -> %{"url" => url} when is_list(url) ->