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...'.
This commit is contained in:
Johann150 2022-12-08 18:12:24 +01:00
parent e2ce599aca
commit 1faf1035f9
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -10,7 +10,12 @@ export async function deleteActor(actor: CacheableRemoteUser, uri: string): Prom
return `skip: delete actor ${actor.uri} !== ${uri}`; 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) { if (user.isDeleted) {
apLogger.info('skip: already deleted'); apLogger.info('skip: already deleted');
} }