[backend] Catch errors in refetchPublicKeyForApId

This commit is contained in:
Laura Hausmann 2023-10-24 20:44:30 +02:00
parent 3b85491ee4
commit 9b13ec9c0c
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -206,12 +206,17 @@ export default class DbResolver {
} }
public async refetchPublicKeyForApId(user: CacheableRemoteUser): Promise<UserPublickey | null> { public async refetchPublicKeyForApId(user: CacheableRemoteUser): Promise<UserPublickey | null> {
await updatePerson(user.uri!, undefined, undefined, user); try {
let key = await UserPublickeys.findOneBy({ userId: user.id }); await updatePerson(user.uri!, undefined, undefined, user);
if (key != null) { let key = await UserPublickeys.findOneBy({ userId: user.id });
await publicKeyByUserIdCache.set(user.id, key); if (key != null) {
await publicKeyByUserIdCache.set(user.id, key);
}
return key;
}
catch {
return null;
} }
return key;
} }
} }