From f7a1e2d5d95be3d4dcc2f9aa1f43d70b8db4d6db Mon Sep 17 00:00:00 2001 From: Oneric Date: Fri, 13 Dec 2024 01:10:26 +0100 Subject: [PATCH] federator: don't fetch the user for no reason The return value is never used here; later stages which actually need it fetch the user themselves and it doesn't matter wheter we wait for the fech here or later (if needed at all). Even more, this early fetch always fails if the user was already deleted or never known to begin with, but we get something referencing it; e.g. the very Delete action carrying out the user deletion. This prevents processing of the Delete, but before that it will be reattempted several times, each time attempring to fetch the non-existing profile, wasting resources. --- lib/pleroma/web/federator.ex | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/pleroma/web/federator.ex b/lib/pleroma/web/federator.ex index aaf89412f..adf8298da 100644 --- a/lib/pleroma/web/federator.ex +++ b/lib/pleroma/web/federator.ex @@ -91,8 +91,7 @@ def perform(:incoming_ap_doc, params) do # NOTE: we use the actor ID to do the containment, this is fine because an # actor shouldn't be acting on objects outside their own AP server. - with {_, {:ok, _user}} <- {:actor, User.get_or_fetch_by_ap_id(actor)}, - nil <- Activity.normalize(params["id"]), + with nil <- Activity.normalize(params["id"]), {_, :ok} <- {:correct_origin?, Containment.contain_origin_from_id(actor, params)}, {:ok, activity} <- Transmogrifier.handle_incoming(params) do