[backend/federation] Fix sporadic key fetch failures in InboxValidationMiddleware (ISH-194)

This commit is contained in:
Laura Hausmann 2024-03-16 18:53:49 +01:00
parent 6dc4b29eba
commit 0c644f7b25
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -90,6 +90,9 @@ public class InboxValidationMiddleware(
if (user == null) throw AuthFetchException.NotFound("Delete activity actor is unknown");
key = await db.UserPublickeys.Include(p => p.User)
.FirstOrDefaultAsync(p => p.User == user, ct);
// If the key is still null here, we have a data consistency issue and need to update the key manually
key ??= await userSvc.UpdateUserPublicKeyAsync(user).WaitAsync(ct);
}
catch (Exception e)
{