summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2020-09-14 14:44:25 +0300
committerrinpatch <rinpatch@sdf.org>2020-09-14 14:44:25 +0300
commitf66a15c4a51e1c8f614b4c1609b2385a29762931 (patch)
tree0268cb47938c44ff15c640c3dead4602704f6d8d
parent2937e3095ab9208b2aea1f42792ab99b1b4252d7 (diff)
RichMedia parser: do not set a cache TTL for unchanging errors
-rw-r--r--lib/pleroma/web/rich_media/parser.ex8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/pleroma/web/rich_media/parser.ex b/lib/pleroma/web/rich_media/parser.ex
index 5727fda18..ab8f35922 100644
--- a/lib/pleroma/web/rich_media/parser.ex
+++ b/lib/pleroma/web/rich_media/parser.ex
@@ -36,6 +36,14 @@ defmodule Pleroma.Web.RichMedia.Parser do
{:ok, _data} = res ->
res
+ {:error, :body_too_large} = e ->
+ e
+
+ {:error, {:content_type, _}} ->
+ e
+
+ # The TTL is not set for the errors above, since they are unlikely to change
+ # with time
{:error, _} = e ->
ttl = Pleroma.Config.get([:rich_media, :failure_backoff], 60_000)
Cachex.expire(:rich_media_cache, url, ttl)