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:
@@ -241,6 +241,9 @@ public sealed class BaseItemRepository
|
||||
public void UpdateInheritedValues()
|
||||
{
|
||||
using var context = _dbProvider.CreateDbContext();
|
||||
var executionStrategy = context.Database.CreateExecutionStrategy();
|
||||
executionStrategy.Execute(() =>
|
||||
{
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
|
||||
context.ItemValuesMap.Where(e => e.ItemValue.Type == ItemValueType.InheritedTags).ExecuteDelete();
|
||||
@@ -248,6 +251,7 @@ public sealed class BaseItemRepository
|
||||
context.SaveChanges();
|
||||
|
||||
transaction.Commit();
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user