RichMedia parser: do not set a cache TTL for unchanging errors
authorrinpatch <rinpatch@sdf.org>
Mon, 14 Sep 2020 11:44:25 +0000 (14:44 +0300)
committerrinpatch <rinpatch@sdf.org>
Mon, 14 Sep 2020 11:44:25 +0000 (14:44 +0300)
lib/pleroma/web/rich_media/parser.ex

index 5727fda189bf39f4ac501461504ff247f1f86fa7..ab8f359223d97a29a59b0f192f46da66b69c8091 100644 (file)
@@ -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)