projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into issue/1880
[akkoma]
/
lib
/
pleroma
/
http
/
connection.ex
diff --git
a/lib/pleroma/http/connection.ex
b/lib/pleroma/http/connection.ex
index 0fc88f708da48ec138ad49b4f88bcdf9ee2552b3..ebacf7902e2c9b10523c7c25d80b70841ef5b841 100644
(file)
--- a/
lib/pleroma/http/connection.ex
+++ b/
lib/pleroma/http/connection.ex
@@
-30,12
+30,12
@@
defmodule Pleroma.HTTP.Connection do
@defaults
|> pool_timeout()
|> Keyword.merge(opts)
@defaults
|> pool_timeout()
|> Keyword.merge(opts)
- |> adapter().options(uri)
+ |> adapter
_helper
().options(uri)
end
defp pool_timeout(opts) do
{config_key, default} =
end
defp pool_timeout(opts) do
{config_key, default} =
- if
Application.get_env(:tesla, :adapter
) == Tesla.Adapter.Gun do
+ if
adapter(
) == Tesla.Adapter.Gun do
{:pools, Config.get([:pools, :default, :timeout])}
else
{:hackney_pools, 10_000}
{:pools, Config.get([:pools, :default, :timeout])}
else
{:hackney_pools, 10_000}
@@
-47,10
+47,12
@@
defmodule Pleroma.HTTP.Connection do
end
@spec after_request(keyword()) :: :ok
end
@spec after_request(keyword()) :: :ok
- def after_request(opts), do: adapter().after_request(opts)
+ def after_request(opts), do: adapter
_helper
().after_request(opts)
- defp adapter do
- case Application.get_env(:tesla, :adapter) do
+ defp adapter, do: Application.get_env(:tesla, :adapter)
+
+ defp adapter_helper do
+ case adapter() do
Tesla.Adapter.Gun -> AdapterHelper.Gun
Tesla.Adapter.Hackney -> AdapterHelper.Hackney
_ -> AdapterHelper
Tesla.Adapter.Gun -> AdapterHelper.Gun
Tesla.Adapter.Hackney -> AdapterHelper.Hackney
_ -> AdapterHelper
@@
-71,15
+73,15
@@
defmodule Pleroma.HTTP.Connection do
{:ok, parse_host(host), port}
else
{_, _} ->
{:ok, parse_host(host), port}
else
{_, _} ->
- Logger.warn("
parsing port in proxy fail
#{inspect(proxy)}")
+ Logger.warn("
Parsing port failed
#{inspect(proxy)}")
{:error, :invalid_proxy_port}
:error ->
{:error, :invalid_proxy_port}
:error ->
- Logger.warn("
parsing port in proxy fail
#{inspect(proxy)}")
+ Logger.warn("
Parsing port failed
#{inspect(proxy)}")
{:error, :invalid_proxy_port}
_ ->
{:error, :invalid_proxy_port}
_ ->
- Logger.warn("
parsing proxy fail
#{inspect(proxy)}")
+ Logger.warn("
Parsing proxy failed
#{inspect(proxy)}")
{:error, :invalid_proxy}
end
end
{:error, :invalid_proxy}
end
end
@@
-89,7
+91,7
@@
defmodule Pleroma.HTTP.Connection do
{:ok, type, parse_host(host), port}
else
_ ->
{:ok, type, parse_host(host), port}
else
_ ->
- Logger.warn("
parsing proxy fail
#{inspect(proxy)}")
+ Logger.warn("
Parsing proxy failed
#{inspect(proxy)}")
{:error, :invalid_proxy}
end
end
{:error, :invalid_proxy}
end
end