adapter options unification

not needed options deletion
This commit is contained in:
Alexander Strizhakov 2020-09-04 19:05:08 +03:00
commit a83916fdac
No known key found for this signature in database
GPG key ID: 022896A53AEF1381
11 changed files with 47 additions and 63 deletions

View file

@ -13,22 +13,16 @@ defmodule Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy do
require Logger
@options [
pool: :media
pool: :media,
recv_timeout: 10_000
]
def perform(:prefetch, url) do
Logger.debug("Prefetching #{inspect(url)}")
opts =
if Application.get_env(:tesla, :adapter) == Tesla.Adapter.Hackney do
Keyword.put(@options, :recv_timeout, 10_000)
else
@options
end
url
|> MediaProxy.url()
|> HTTP.get([], adapter: opts)
|> HTTP.get([], adapter: @options)
end
def perform(:preload, %{"object" => %{"attachment" => attachments}} = _message) do