Rework some Rich Media functionality for better error handling

Oban should not retry jobs that are likely to fail again
This commit is contained in:
Mark Felder 2024-07-17 12:40:07 -04:00
commit d124d8645e
8 changed files with 70 additions and 50 deletions

View file

@ -14,7 +14,17 @@ defmodule Pleroma.Workers.RichMediaWorker do
end
def perform(%Job{args: %{"op" => "backfill", "url" => _url} = args}) do
Backfill.run(args)
case Backfill.run(args) do
:ok ->
:ok
{:error, type}
when type in [:invalid_metadata, :body_too_large, :content_type, :validate] ->
:cancel
error ->
{:error, error}
end
end
@impl Oban.Worker