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.
This commit is contained in:
Mark Felder 2024-07-24 15:43:45 -04:00
parent 731f7b87d2
commit 5a62868106
2 changed files with 2 additions and 10 deletions

View file

@ -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

View file

@ -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