diff options
author | rinpatch <rinpatch@sdf.org> | 2019-10-11 22:52:38 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2019-10-11 22:52:38 +0300 |
commit | 9bdbf0811b362d8eb9d2456e9c87c9dde1b35d9b (patch) | |
tree | c829b1809f8d574d6007a89e531fce3fdb603262 /lib | |
parent | 44afe4c8870d14ae2cd22ff5cfa04555cf5907bd (diff) | |
download | pleroma-9bdbf0811b362d8eb9d2456e9c87c9dde1b35d9b.tar.gz |
Make MediaProxy failure tracking less brutal
The current failure tracking mechanism will never request anything that
didn't respond with a success, 403, 404, or 5xx codes. This is causing
issues when using in real fediverse because of weird status codes
some software has and timeouts being frequent. This patch changes
failure tracking mechanism to only never request the url again if it
responded with 400, 204, or the body is too large, otherwise it can be
re-requested in 60 seconds.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/reverse_proxy/reverse_proxy.ex | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/pleroma/reverse_proxy/reverse_proxy.ex b/lib/pleroma/reverse_proxy/reverse_proxy.ex index 78144cae3..2ed719315 100644 --- a/lib/pleroma/reverse_proxy/reverse_proxy.ex +++ b/lib/pleroma/reverse_proxy/reverse_proxy.ex @@ -401,11 +401,9 @@ defmodule Pleroma.ReverseProxy do defp client, do: Pleroma.ReverseProxy.Client - defp track_failed_url(url, code, opts) do - code = to_string(code) - + defp track_failed_url(url, error, opts) do ttl = - if code in ["403", "404"] or String.starts_with?(code, "5") do + unless error in [:body_too_large, 400, 204] do Keyword.get(opts, :failed_request_ttl, @failed_request_ttl) else nil |