From 4a408dc6254197930ecc7e6dafd864f530b06127 Mon Sep 17 00:00:00 2001 From: Wendell Jones Date: Wed, 10 Jun 2026 12:09:55 -0400 Subject: [PATCH] Use execution strategy in UpdateInheritedValues Refactored BaseItemRepository.UpdateInheritedValues to execute its transaction logic within the database execution strategy, improving resilience against transient database errors. --- .../Item/BaseItemRepository.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs index 74c2ac19..8ce77df5 100644 --- a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs +++ b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs @@ -241,13 +241,17 @@ public sealed class BaseItemRepository public void UpdateInheritedValues() { using var context = _dbProvider.CreateDbContext(); - using var transaction = context.Database.BeginTransaction(); + var executionStrategy = context.Database.CreateExecutionStrategy(); + executionStrategy.Execute(() => + { + using var transaction = context.Database.BeginTransaction(); - context.ItemValuesMap.Where(e => e.ItemValue.Type == ItemValueType.InheritedTags).ExecuteDelete(); - // ItemValue Inheritance is now correctly mapped via AncestorId on demand - context.SaveChanges(); + context.ItemValuesMap.Where(e => e.ItemValue.Type == ItemValueType.InheritedTags).ExecuteDelete(); + // ItemValue Inheritance is now correctly mapped via AncestorId on demand + context.SaveChanges(); - transaction.Commit(); + transaction.Commit(); + }); } ///