From 19afd9f81ff0b0e966a432db6ea15930d3712c85 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 7 Mar 2019 23:49:02 +0000 Subject: [PATCH] http: rework connection timeouts to match hackney docs, enforce 1 second max TCP connection timeout --- lib/pleroma/http/connection.ex | 4 ++-- lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 1 - lib/pleroma/web/rel_me.ex | 1 - lib/pleroma/web/rich_media/parser.ex | 1 - 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/http/connection.ex b/lib/pleroma/http/connection.ex index cc2e96e2b..926f892ba 100644 --- a/lib/pleroma/http/connection.ex +++ b/lib/pleroma/http/connection.ex @@ -8,8 +8,8 @@ defmodule Pleroma.HTTP.Connection do """ @hackney_options [ - timeout: 10000, - recv_timeout: 20000, + connect_timeout: 1_000, + recv_timeout: 10_000, follow_redirect: true, pool: :federation ] diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 8c58f4545..26921d386 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -1452,7 +1452,6 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do url, [], adapter: [ - timeout: timeout, recv_timeout: timeout, pool: :default ] diff --git a/lib/pleroma/web/rel_me.ex b/lib/pleroma/web/rel_me.ex index ab29a36e3..eaca41132 100644 --- a/lib/pleroma/web/rel_me.ex +++ b/lib/pleroma/web/rel_me.ex @@ -5,7 +5,6 @@ defmodule Pleroma.Web.RelMe do @hackney_options [ pool: :media, - timeout: 2_000, recv_timeout: 2_000, max_body: 2_000_000 ] diff --git a/lib/pleroma/web/rich_media/parser.ex b/lib/pleroma/web/rich_media/parser.ex index 4341141df..4bd271d8e 100644 --- a/lib/pleroma/web/rich_media/parser.ex +++ b/lib/pleroma/web/rich_media/parser.ex @@ -11,7 +11,6 @@ defmodule Pleroma.Web.RichMedia.Parser do @hackney_options [ pool: :media, - timeout: 2_000, recv_timeout: 2_000, max_body: 2_000_000 ] -- 2.45.2