remove pool and timeout options which duplicate with the default

This commit is contained in:
Hakaba Hitoyo 2018-12-06 11:23:15 +09:00
parent 505d820827
commit 27792b2d77
5 changed files with 9 additions and 22 deletions

View File

@ -3,7 +3,11 @@ defmodule Pleroma.HTTP.Connection do
Connection for http-requests. Connection for http-requests.
""" """
@hackney_options [pool: :default] @hackney_options [
pool: :default,
timeout: 10000,
recv_timeout: 20000
]
@adapter Application.get_env(:tesla, :adapter) @adapter Application.get_env(:tesla, :adapter)
@doc """ @doc """

View File

@ -766,9 +766,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
@httpoison.get( @httpoison.get(
id, id,
[Accept: "application/activity+json"], [Accept: "application/activity+json"],
follow_redirect: true, follow_redirect: true
timeout: 10000,
recv_timeout: 20000
), ),
{:ok, data} <- Jason.decode(body), {:ok, data} <- Jason.decode(body),
:ok <- Transmogrifier.contain_origin_from_id(id, data) do :ok <- Transmogrifier.contain_origin_from_id(id, data) do

View File

@ -350,11 +350,7 @@ defmodule Pleroma.Web.OStatus do
@httpoison.get( @httpoison.get(
url, url,
[Accept: "application/atom+xml"], [Accept: "application/atom+xml"],
follow_redirect: true, follow_redirect: true
adapter: [
timeout: 10000,
recv_timeout: 20000
]
) do ) do
Logger.debug("Got document from #{url}, handling...") Logger.debug("Got document from #{url}, handling...")
handle_incoming(body) handle_incoming(body)
@ -369,8 +365,7 @@ defmodule Pleroma.Web.OStatus do
Logger.debug("Trying to fetch #{url}") Logger.debug("Trying to fetch #{url}")
with true <- String.starts_with?(url, "http"), with true <- String.starts_with?(url, "http"),
{:ok, %{body: body}} <- {:ok, %{body: body}} <- @httpoison.get(url, [], follow_redirect: true),
@httpoison.get(url, [], follow_redirect: true, timeout: 10000, recv_timeout: 20000),
{:ok, atom_url} <- get_atom_url(body) do {:ok, atom_url} <- get_atom_url(body) do
fetch_activity_from_atom_url(atom_url) fetch_activity_from_atom_url(atom_url)
else else

View File

@ -162,12 +162,7 @@ defmodule Pleroma.Web.Salmon do
poster.( poster.(
salmon, salmon,
feed, feed,
[{"Content-Type", "application/magic-envelope+xml"}], [{"Content-Type", "application/magic-envelope+xml"}]
adapter: [
timeout: 10000,
recv_timeout: 20000,
pool: :default
]
) do ) do
Logger.debug(fn -> "Pushed to #{salmon}, code #{code}" end) Logger.debug(fn -> "Pushed to #{salmon}, code #{code}" end)
else else

View File

@ -264,11 +264,6 @@ defmodule Pleroma.Web.Websub do
[ [
{"Content-Type", "application/atom+xml"}, {"Content-Type", "application/atom+xml"},
{"X-Hub-Signature", "sha1=#{signature}"} {"X-Hub-Signature", "sha1=#{signature}"}
],
adapter: [
timeout: 10000,
recv_timeout: 20000,
pool: :default
] ]
) do ) do
Logger.info(fn -> "Pushed to #{callback}, code #{code}" end) Logger.info(fn -> "Pushed to #{callback}, code #{code}" end)