From d62a9afed3fe08aeaf9d2d9f0ca79736a1f24578 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 20 Jul 2024 21:52:57 -0400 Subject: [PATCH] Improved detecting unrecoverable errors for incoming federation jobs --- changelog.d/oban-cancel-receiverworker.change | 1 + lib/pleroma/workers/receiver_worker.ex | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 changelog.d/oban-cancel-receiverworker.change diff --git a/changelog.d/oban-cancel-receiverworker.change b/changelog.d/oban-cancel-receiverworker.change new file mode 100644 index 000000000..70ad22d60 --- /dev/null +++ b/changelog.d/oban-cancel-receiverworker.change @@ -0,0 +1 @@ +Improved detecting unrecoverable errors for incoming federation jobs diff --git a/lib/pleroma/workers/receiver_worker.ex b/lib/pleroma/workers/receiver_worker.ex index 8b2052c23..cf1269a1f 100644 --- a/lib/pleroma/workers/receiver_worker.ex +++ b/lib/pleroma/workers/receiver_worker.ex @@ -47,11 +47,13 @@ defmodule Pleroma.Workers.ReceiverWorker do case errors do {:error, :origin_containment_failed} -> {:cancel, :origin_containment_failed} {:error, :already_present} -> {:cancel, :already_present} - {:error, {:validate_object, reason}} -> {:cancel, reason} - {:error, {:error, {:validate, reason}}} -> {:cancel, reason} - {:error, {:reject, reason}} -> {:cancel, reason} + {:error, {:validate_object, _} = reason} -> {:cancel, reason} + {:error, {:validate, _} = reason} -> {:cancel, reason} + {:error, {:reject, _} = reason} -> {:cancel, reason} {:signature, false} -> {:cancel, :invalid_signature} - {:error, {:error, reason = "Object has been deleted"}} -> {:cancel, reason} + {:error, "Object has been deleted"} = reason -> {:cancel, reason} + {:error, {:side_effects, {:error, :no_object_actor}} = reason} -> {:cancel, reason} + {:error, :not_found} = reason -> {:cancel, reason} {:error, _} = e -> e e -> {:error, e} end