Connection for http-requests.
"""
- @hackney_options [pool: :default]
+ @hackney_options [
+ pool: :default,
+ timeout: 10000,
+ recv_timeout: 20000
+ ]
@adapter Application.get_env(:tesla, :adapter)
@doc """
@httpoison.get(
id,
[Accept: "application/activity+json"],
- follow_redirect: true,
- timeout: 10000,
- recv_timeout: 20000
+ follow_redirect: true
),
{:ok, data} <- Jason.decode(body),
:ok <- Transmogrifier.contain_origin_from_id(id, data) do
@httpoison.get(
url,
[Accept: "application/atom+xml"],
- follow_redirect: true,
- adapter: [
- timeout: 10000,
- recv_timeout: 20000
- ]
+ follow_redirect: true
) do
Logger.debug("Got document from #{url}, handling...")
handle_incoming(body)
Logger.debug("Trying to fetch #{url}")
with true <- String.starts_with?(url, "http"),
- {:ok, %{body: body}} <-
- @httpoison.get(url, [], follow_redirect: true, timeout: 10000, recv_timeout: 20000),
+ {:ok, %{body: body}} <- @httpoison.get(url, [], follow_redirect: true),
{:ok, atom_url} <- get_atom_url(body) do
fetch_activity_from_atom_url(atom_url)
else
poster.(
salmon,
feed,
- [{"Content-Type", "application/magic-envelope+xml"}],
- adapter: [
- timeout: 10000,
- recv_timeout: 20000,
- pool: :default
- ]
+ [{"Content-Type", "application/magic-envelope+xml"}]
) do
Logger.debug(fn -> "Pushed to #{salmon}, code #{code}" end)
else
[
{"Content-Type", "application/atom+xml"},
{"X-Hub-Signature", "sha1=#{signature}"}
- ],
- adapter: [
- timeout: 10000,
- recv_timeout: 20000,
- pool: :default
]
) do
Logger.info(fn -> "Pushed to #{callback}, code #{code}" end)