diff options
| author | Shadowghost <Shadowghost@users.noreply.github.com> | 2026-11-20 07:25:17 -0500 |
|---|---|---|
| committer | Cody Robibero <cody@robibe.ro> | 2026-11-20 07:25:17 -0500 |
| commit | 0503e92bfc894c88c2b23974ef5cd2c700cd25fa (patch) | |
| tree | c27c6f8b6b086f30284c31d1d285ef50a4467a31 /Jellyfin.Server.Implementations | |
| parent | 4c16e068c9d1f108d68a74253f759048ffa932eb (diff) | |
Backport pull request #18645 from jellyfin/release-12.z
Fix "too many SQL variables" when saving large scan batches and playlists
Original-merge: e66161258b926a78be16e0583a3af873fe48305a
Merged-by: Bond-009 <bond.009@outlook.com>
Backported-by: Cody Robibero <cody@robibe.ro>
Diffstat (limited to 'Jellyfin.Server.Implementations')
| -rw-r--r-- | Jellyfin.Server.Implementations/Item/ItemPersistenceService.cs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Jellyfin.Server.Implementations/Item/ItemPersistenceService.cs b/Jellyfin.Server.Implementations/Item/ItemPersistenceService.cs index 3bf33b969e..4e7e5a5331 100644 --- a/Jellyfin.Server.Implementations/Item/ItemPersistenceService.cs +++ b/Jellyfin.Server.Implementations/Item/ItemPersistenceService.cs @@ -374,7 +374,8 @@ public class ItemPersistenceService : IItemPersistenceService var allListedItemValuesSet = allListedItemValues.ToHashSet(); var existingValues = context.ItemValues - .Where(e => types.Contains(e.Type) && values.Contains(e.Value)) + .WhereOneOrMany(types, e => e.Type) + .WhereOneOrMany(values, e => e.Value) .AsEnumerable() .Where(e => allListedItemValuesSet.Contains((e.Type, e.Value))) .ToArray(); @@ -428,7 +429,7 @@ public class ItemPersistenceService : IItemPersistenceService var allExistingAncestorIds = itemsWithAncestors.Count > 0 ? context.AncestorIds - .Where(e => itemsWithAncestors.Contains(e.ItemId)) + .WhereOneOrMany(itemsWithAncestors, e => e.ItemId) .ToList() .GroupBy(e => e.ItemId) .ToDictionary(g => g.Key, g => g.ToList()) @@ -442,7 +443,7 @@ public class ItemPersistenceService : IItemPersistenceService var validAncestorIdsSet = allRequestedAncestorIds.Count > 0 ? context.BaseItems - .Where(e => allRequestedAncestorIds.Contains(e.Id)) + .WhereOneOrMany(allRequestedAncestorIds, e => e.Id) .Select(f => f.Id) .ToHashSet() : new HashSet<Guid>(); @@ -502,7 +503,7 @@ public class ItemPersistenceService : IItemPersistenceService { var allParentIds = folderIds.Concat(videoIds).Distinct().ToList(); var allLinkedChildren = context.LinkedChildren - .Where(e => allParentIds.Contains(e.ParentId)) + .WhereOneOrMany(allParentIds, e => e.ParentId) .ToList(); allLinkedChildrenByParent = allLinkedChildren @@ -572,7 +573,7 @@ public class ItemPersistenceService : IItemPersistenceService var pathToIdMap = pathsToResolve.Count > 0 ? context.BaseItems - .Where(e => e.Path != null && pathsToResolve.Contains(e.Path)) + .WhereOneOrMany(pathsToResolve, e => e.Path!) .Select(e => new { e.Path, e.Id }) .GroupBy(e => e.Path!) .ToDictionary(g => g.Key, g => g.First().Id) |
