From 6a184115a2431727b5039c1c726a8afc5eef228c Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Fri, 23 Jun 2017 12:25:53 +0200 Subject: [PATCH] Longer timeouts for outgoing federation. --- lib/pleroma/web/salmon/salmon.ex | 2 +- lib/pleroma/web/websub/websub.ex | 6 +++--- test/web/salmon/salmon_test.exs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/web/salmon/salmon.ex b/lib/pleroma/web/salmon/salmon.ex index b4f81b4ed..e2eff857f 100644 --- a/lib/pleroma/web/salmon/salmon.ex +++ b/lib/pleroma/web/salmon/salmon.ex @@ -132,7 +132,7 @@ def remote_users(%{data: %{"to" => to}}) do end defp send_to_user(%{info: %{"salmon" => salmon}}, feed, poster) do - poster.(salmon, feed, [{"Content-Type", "application/magic-envelope+xml"}]) + poster.(salmon, feed, [{"Content-Type", "application/magic-envelope+xml"}], timeout: 10000, recv_timeout: 20000) end defp send_to_user(_,_,_), do: nil diff --git a/lib/pleroma/web/websub/websub.ex b/lib/pleroma/web/websub/websub.ex index 410303b77..a5309ebd9 100644 --- a/lib/pleroma/web/websub/websub.ex +++ b/lib/pleroma/web/websub/websub.ex @@ -54,9 +54,9 @@ def publish(topic, user, activity) do Task.start(fn -> with {:ok, %{status_code: code}} <- @httpoison.post(sub.callback, response, [ - {"Content-Type", "application/atom+xml"}, - {"X-Hub-Signature", "sha1=#{signature}"} - ]) do + {"Content-Type", "application/atom+xml"}, + {"X-Hub-Signature", "sha1=#{signature}"} + ], timeout: 10000, recv_timeout: 20000) do Logger.debug(fn -> "Pushed to #{sub.callback}, code #{code}" end) else e -> Logger.debug(fn -> "Couldn't push to #{sub.callback}, #{inspect(e)}" end) diff --git a/test/web/salmon/salmon_test.exs b/test/web/salmon/salmon_test.exs index 65d81e44f..e722f08ef 100644 --- a/test/web/salmon/salmon_test.exs +++ b/test/web/salmon/salmon_test.exs @@ -84,7 +84,7 @@ test "it pushes an activity to remote accounts it's addressed to" do user = Repo.get_by(User, ap_id: activity.data["actor"]) {:ok, user} = Pleroma.Web.WebFinger.ensure_keys_present(user) - poster = fn (url, data, headers) -> + poster = fn (url, data, headers, options) -> assert url == "http://example.org/salmon" end Salmon.publish(user, activity, poster)