forked from AkkomaGang/akkoma
[#2497] Removed Hackney-specific code
(no longer needed due to adapter options unification).
This commit is contained in:
parent
b4860c57a6
commit
148bc24435
1 changed files with 3 additions and 10 deletions
|
@ -13,17 +13,10 @@ defmodule Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy do
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@adapter_options [
|
@adapter_options [
|
||||||
pool: :media
|
pool: :media,
|
||||||
|
recv_timeout: 10_000
|
||||||
]
|
]
|
||||||
|
|
||||||
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
|
||||||
|
@ -32,7 +25,7 @@ def perform(:prefetch, url) do
|
||||||
|
|
||||||
Logger.debug("Prefetching #{inspect(url)} as #{inspect(prefetch_url)}")
|
Logger.debug("Prefetching #{inspect(url)} as #{inspect(prefetch_url)}")
|
||||||
|
|
||||||
HTTP.get(prefetch_url, [], adapter: adapter_options())
|
HTTP.get(prefetch_url, [], @adapter_options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue