Treat containment failure as cancel in ReceiverWorker

This commit is contained in:
Tusooa Zhu 2022-08-08 08:41:33 -04:00
parent 88e0e6acd5
commit d487e0160c
No known key found for this signature in database
GPG Key ID: 7B467EDE43A08224
2 changed files with 2 additions and 1 deletions

View File

@ -12,6 +12,7 @@ defmodule Pleroma.Workers.ReceiverWorker do
with {:ok, res} <- Federator.perform(:incoming_ap_doc, params) do with {:ok, res} <- Federator.perform(:incoming_ap_doc, params) do
{:ok, res} {:ok, res}
else else
{:error, :origin_containment_failed} -> {:cancel, :origin_containment_failed}
{:error, {:reject, reason}} -> {:cancel, reason} {:error, {:reject, reason}} -> {:cancel, reason}
e -> e e -> e
end end

View File

@ -153,7 +153,7 @@ defmodule Pleroma.Web.FederatorTest do
} }
assert {:ok, job} = Federator.incoming_ap_doc(params) assert {:ok, job} = Federator.incoming_ap_doc(params)
assert {:error, :origin_containment_failed} = ObanHelpers.perform(job) assert {:cancel, :origin_containment_failed} = ObanHelpers.perform(job)
end end
test "it does not crash if MRF rejects the post" do test "it does not crash if MRF rejects the post" do