[backend/federation] Force mentions resolution on UpdateUserAsync

This commit is contained in:
Laura Hausmann 2024-02-26 20:19:18 +01:00
parent 9a01fbecdd
commit b8d92b56bb
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -289,7 +289,7 @@ public class UserService(
db.Update(user);
await db.SaveChangesAsync();
await processPendingDeletes();
await UpdateProfileMentions(user, actor);
await UpdateProfileMentions(user, actor, force: true);
return user;
}
@ -624,9 +624,9 @@ public class UserService(
[SuppressMessage("ReSharper", "EntityFramework.NPlusOne.IncompleteDataQuery", Justification = "Projectables")]
[SuppressMessage("ReSharper", "EntityFramework.NPlusOne.IncompleteDataUsage", Justification = "Same as above")]
[SuppressMessage("ReSharper", "SuggestBaseTypeForParameter", Justification = "Method only makes sense for users")]
private async Task UpdateProfileMentions(User user, ASActor? actor)
private async Task UpdateProfileMentions(User user, ASActor? actor, bool force = false)
{
if (followupTaskSvc.IsBackgroundWorker) return;
if (followupTaskSvc.IsBackgroundWorker && !force) return;
if (KeyedLocker.IsInUse($"profileMentions:{user.Id}")) return;
var task = followupTaskSvc.ExecuteTask("UpdateProfileMentionsInBackground", async provider =>