feat: implement migration tracking and history management for PostgreSQL

This commit is contained in:
2026-05-04 12:47:12 -04:00
parent e67c191843
commit 4ccd84342b
12 changed files with 191 additions and 192 deletions
+7 -1
View File
@@ -420,6 +420,7 @@ namespace MediaBrowser.Controller.Entities
// Create a list for our validated children
var newItems = new List<BaseItem>();
var changedItems = new List<BaseItem>();
cancellationToken.ThrowIfCancellationRequested();
@@ -436,7 +437,7 @@ namespace MediaBrowser.Controller.Entities
if (currentChild.UpdateFromResolvedItem(child) > ItemUpdateType.None)
{
await currentChild.UpdateToRepositoryAsync(ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);
changedItems.Add(currentChild);
}
else
{
@@ -484,6 +485,11 @@ namespace MediaBrowser.Controller.Entities
LibraryManager.CreateItems(newItems, this, cancellationToken);
}
if (changedItems.Count > 0)
{
await LibraryManager.UpdateItemsAsync(changedItems, this, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);
}
// After removing items, reattach any detached user data to remaining children
// that share the same user data keys (eg. same episode replaced with a new file).
if (actuallyRemoved.Count > 0)
@@ -115,7 +115,7 @@ public sealed class LimitedConcurrencyLibraryScheduler : ILimitedConcurrencyLibr
if (fanoutConcurrency <= 0)
{
// in case the user did not set a limit manually, we can assume he has 3 or more cores as already checked by ShouldForceSequentialOperation.
return Environment.ProcessorCount - 3;
return Math.Max(2, Environment.ProcessorCount / 2);
}
return fanoutConcurrency;