From 1faf1035f93fcf6c005db65bccab4599586be0fd Mon Sep 17 00:00:00 2001 From: Johann150 Date: Thu, 8 Dec 2022 18:12:24 +0100 Subject: [PATCH] server: handle users getting deleted somewhere else I don't know why but several jobs got stuck in my inbox queue because of errors like 'Could not find any entity of type "User" matching...'. --- .../backend/src/remote/activitypub/kernel/delete/actor.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/remote/activitypub/kernel/delete/actor.ts b/packages/backend/src/remote/activitypub/kernel/delete/actor.ts index 7d09d8fa3..9467eb535 100644 --- a/packages/backend/src/remote/activitypub/kernel/delete/actor.ts +++ b/packages/backend/src/remote/activitypub/kernel/delete/actor.ts @@ -10,7 +10,12 @@ export async function deleteActor(actor: CacheableRemoteUser, uri: string): Prom return `skip: delete actor ${actor.uri} !== ${uri}`; } - const user = await Users.findOneByOrFail({ id: actor.id }); + const user = await Users.findOneBy({ id: actor.id }); + if (!user) { + // maybe a race condition, relay or something else? + // anyway, the user is gone now so dont care + return 'ok: gone'; + } if (user.isDeleted) { apLogger.info('skip: already deleted'); }