[backend/core] Fix race condition in NoteResolver.UpdatePinnedNotesAsync

This commit is contained in:
Laura Hausmann 2024-03-25 19:42:55 +01:00
parent 7e93059368
commit e1bdd7d0f4
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -1163,7 +1163,9 @@ public class NoteService(
collection = await objectResolver.ResolveObject(collection, force: true) as ASOrderedCollection; collection = await objectResolver.ResolveObject(collection, force: true) as ASOrderedCollection;
if (collection is not { Items: not null }) return; if (collection is not { Items: not null }) return;
var items = await collection.Items.Take(10).Select(p => objectResolver.ResolveObject(p)).AwaitAllAsync(); var items = await collection.Items.Take(10)
.Select(p => objectResolver.ResolveObject(p))
.AwaitAllNoConcurrencyAsync();
var notes = await items.OfType<ASNote>() var notes = await items.OfType<ASNote>()
.Select(p => ResolveNoteAsync(p.Id, p, null, true)) .Select(p => ResolveNoteAsync(p.Id, p, null, true))
.AwaitAllNoConcurrencyAsync(); .AwaitAllNoConcurrencyAsync();