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 @@ def perform(%Job{args: %{"op" => "incoming_ap_doc", "params" => params}}) do
with {:ok, res} <- Federator.perform(:incoming_ap_doc, params) do
{:ok, res}
else
{:error, :origin_containment_failed} -> {:cancel, :origin_containment_failed}
{:error, {:reject, reason}} -> {:cancel, reason}
e -> e
end

View File

@ -153,7 +153,7 @@ test "rejects incoming AP docs with incorrect origin" do
}
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
test "it does not crash if MRF rejects the post" do