Don’t reattempt insertion of already known objects

Might happen if we receive e.g. a Like before the Note arrives
in our inbox and we thus already queried the Note ourselves.
This commit is contained in:
Oneric 2024-10-29 01:47:54 +01:00
parent 90e1061651
commit c5dbd17702
2 changed files with 2 additions and 1 deletions

View file

@ -14,6 +14,7 @@ def perform(%Job{args: %{"op" => "incoming_ap_doc", "params" => params}}) do
else
{:error, :origin_containment_failed} -> {:discard, :origin_containment_failed}
{:error, {:reject, reason}} -> {:discard, reason}
{:error, :already_present} -> {:discard, :already_present}
{:error, _} = e -> e
e -> {:error, e}
end

View file

@ -132,7 +132,7 @@ test "successfully processes incoming AP docs with correct origin" do
assert {:ok, _activity} = ObanHelpers.perform(job)
assert {:ok, job} = Federator.incoming_ap_doc(params)
assert {:error, :already_present} = ObanHelpers.perform(job)
assert {:discard, :already_present} = ObanHelpers.perform(job)
end
test "successfully normalises public scope descriptors" do