logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 5a62868106465bd30be11922b4ff3b11b3c174aa
parent 731f7b87d24bd58d5349c7d1f564cd73dbf59aa9
Author: Mark Felder <feld@feld.me>
Date:   Wed, 24 Jul 2024 15:43:45 -0400

Consider errors during HTTP GET and HEAD to be unrecoverable and insert a negative cache entry

This is for a normal HTTP error response or timeout while receiving the data. A hard error from a process crash, DNS lookup failure, etc should produce a different response than {:ok, %Tesla.Env{}} and the request/job will be retryable.

Diffstat:

Mlib/pleroma/web/rich_media/backfill.ex6+-----
Mlib/pleroma/workers/rich_media_worker.ex6+-----
2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/lib/pleroma/web/rich_media/backfill.ex b/lib/pleroma/web/rich_media/backfill.ex @@ -36,13 +36,9 @@ defmodule Pleroma.Web.RichMedia.Backfill do :ok {:error, type} = error - when type in [:invalid_metadata, :body_too_large, :content_type, :validate] -> + when type in [:invalid_metadata, :body_too_large, :content_type, :validate, :get, :head] -> negative_cache(url_hash) error - - {:error, type} = error - when type in [:get, :head] -> - error end end diff --git a/lib/pleroma/workers/rich_media_worker.ex b/lib/pleroma/workers/rich_media_worker.ex @@ -20,13 +20,9 @@ defmodule Pleroma.Workers.RichMediaWorker do :ok {:error, type} - when type in [:invalid_metadata, :body_too_large, :content_type, :validate] -> + when type in [:invalid_metadata, :body_too_large, :content_type, :validate, :get, :head] -> {:cancel, type} - {:error, type} - when type in [:get, :head] -> - {:error, type} - error -> {:error, error} end