diff options
| author | Cody Robibero <cody@robibe.ro> | 2026-08-10 16:15:54 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-10 16:15:54 -0400 |
| commit | 35e86416af32adaa220a241f756544cd316bd866 (patch) | |
| tree | 764c783743013febe43025bba596f2052f3603d8 /Jellyfin.Server.Implementations | |
| parent | c210ea87f26248e256ac1b88b1a00fd854642c5e (diff) | |
| parent | 505a6ebf8f4a36a2deb8e2a7cff3809643e8f654 (diff) | |
Merge pull request #17576 from obiwantoby/perf/batch-mediasourcecount-dto
Bugfix: #17547 | Batching MediaSourceCount into one call
Diffstat (limited to 'Jellyfin.Server.Implementations')
| -rw-r--r-- | Jellyfin.Server.Implementations/Item/LinkedChildrenService.cs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Jellyfin.Server.Implementations/Item/LinkedChildrenService.cs b/Jellyfin.Server.Implementations/Item/LinkedChildrenService.cs index 5f1d9bf87a..d46f7b3c4c 100644 --- a/Jellyfin.Server.Implementations/Item/LinkedChildrenService.cs +++ b/Jellyfin.Server.Implementations/Item/LinkedChildrenService.cs @@ -60,6 +60,25 @@ public class LinkedChildrenService : ILinkedChildrenService } /// <inheritdoc/> + public IReadOnlySet<Guid> GetItemIdsWithAlternateVersions(IReadOnlyList<Guid> itemIds) + { + if (itemIds.Count == 0) + { + return new HashSet<Guid>(); + } + + using var dbContext = _dbProvider.CreateDbContext(); + + return dbContext.LinkedChildren + .Where(lc => lc.ChildType == DbLinkedChildType.LocalAlternateVersion + || lc.ChildType == DbLinkedChildType.LinkedAlternateVersion) + .WhereOneOrMany(itemIds as IList<Guid> ?? itemIds.ToList(), lc => lc.ParentId) + .Select(lc => lc.ParentId) + .Distinct() + .ToHashSet(); + } + + /// <inheritdoc/> public IReadOnlyDictionary<string, MusicArtist[]> FindArtists(IReadOnlyList<string> artistNames) { using var dbContext = _dbProvider.CreateDbContext(); |
