diff --git a/Iceshrimp.Backend/Core/Federation/ActivityPub/ObjectResolver.cs b/Iceshrimp.Backend/Core/Federation/ActivityPub/ObjectResolver.cs index 05b9e34f..a52c994b 100644 --- a/Iceshrimp.Backend/Core/Federation/ActivityPub/ObjectResolver.cs +++ b/Iceshrimp.Backend/Core/Federation/ActivityPub/ObjectResolver.cs @@ -78,7 +78,7 @@ public class ObjectResolver( } } - public async IAsyncEnumerable IterateCollection(ASCollection? collection) + public async IAsyncEnumerable IterateCollection(ASCollection? collection, int pageLimit = 10) { if (collection == null) yield break; @@ -91,10 +91,6 @@ public class ObjectResolver( foreach (var item in collection.Items) yield return item; - // we only limit based on pages here. the consumer of this iterator may - // additionally limit per-item via System.Linq.Async Take() - var pageLimit = 50; - // some remote software (e.g. fedibird) can get in a state where page.next == page.id var visitedPages = new HashSet(); @@ -118,6 +114,8 @@ public class ObjectResolver( visitedPages.Add(page.Next.Id); } + // we only limit based on pages here. the consumer of this iterator may + // additionally limit per-item via System.Linq.Async Take() if (--pageLimit <= 0) break; diff --git a/Iceshrimp.Backend/Core/Services/NoteService.cs b/Iceshrimp.Backend/Core/Services/NoteService.cs index d10924cb..e612dc7d 100644 --- a/Iceshrimp.Backend/Core/Services/NoteService.cs +++ b/Iceshrimp.Backend/Core/Services/NoteService.cs @@ -1195,7 +1195,7 @@ public class NoteService( _recursionLimit = recursionLimit; await objectResolver.IterateCollection(repliesCollection) - .Take(100) // does this limit make sense? + .Take(50) .Where(p => p.Id != null && (replyBackfillConfig.BackfillEverything || new Uri(p.Id).Authority == collectionId.Authority)) .Select(p => ResolveNoteAsync(p.Id!, null, fetchUser, forceRefresh: false)) .AwaitAllNoConcurrencyAsync();