From: rinpatch Date: Mon, 14 Sep 2020 11:44:25 +0000 (+0300) Subject: RichMedia parser: do not set a cache TTL for unchanging errors X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=f66a15c4a51e1c8f614b4c1609b2385a29762931;p=akkoma RichMedia parser: do not set a cache TTL for unchanging errors --- 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)