Use execution strategy in UpdateInheritedValues

Refactored BaseItemRepository.UpdateInheritedValues to execute its transaction logic within the database execution strategy, improving resilience against transient database errors.
This commit is contained in:
2026-06-10 12:09:55 -04:00
parent b2d7513cf2
commit 4a408dc625
@@ -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();
});
}
/// <inheritdoc />