diff options
| author | JPVenson <github@jpb.email> | 2025-09-25 00:20:30 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-24 15:20:30 -0600 |
| commit | 5a6d9180fed81a30cb91ef3fed30176cd4402116 (patch) | |
| tree | c67bfa1cfe27ff1a7b7a09e3a7d201ef543652a0 /Emby.Server.Implementations/Library/Validators/PeopleValidator.cs | |
| parent | 897975fc57f1669322f6db18753939dbf6be43e8 (diff) | |
Add People Dedup and multiple progress fixes (#14848)
Diffstat (limited to 'Emby.Server.Implementations/Library/Validators/PeopleValidator.cs')
| -rw-r--r-- | Emby.Server.Implementations/Library/Validators/PeopleValidator.cs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/Emby.Server.Implementations/Library/Validators/PeopleValidator.cs b/Emby.Server.Implementations/Library/Validators/PeopleValidator.cs index b7fd24fa5..f9a6f0d19 100644 --- a/Emby.Server.Implementations/Library/Validators/PeopleValidator.cs +++ b/Emby.Server.Implementations/Library/Validators/PeopleValidator.cs @@ -1,5 +1,5 @@ using System; -using System.Globalization; +using System.Linq; using System.Threading; using System.Threading.Tasks; using Jellyfin.Data.Enums; @@ -55,6 +55,8 @@ public class PeopleValidator var numPeople = people.Count; + IProgress<double> subProgress = new Progress<double>((val) => progress.Report(val / 2)); + _logger.LogDebug("Will refresh {Amount} people", numPeople); foreach (var person in people) @@ -92,7 +94,7 @@ public class PeopleValidator double percent = numComplete; percent /= numPeople; - progress.Report(100 * percent); + subProgress.Report(100 * percent); } var deadEntities = _libraryManager.GetItemList(new InternalItemsQuery @@ -102,17 +104,13 @@ public class PeopleValidator IsLocked = false }); - foreach (var item in deadEntities) - { - _logger.LogInformation("Deleting dead {ItemType} {ItemId} {ItemName}", item.GetType().Name, item.Id.ToString("N", CultureInfo.InvariantCulture), item.Name); + subProgress = new Progress<double>((val) => progress.Report((val / 2) + 50)); - _libraryManager.DeleteItem( - item, - new DeleteOptions - { - DeleteFileLocation = false - }, - false); + var i = 0; + foreach (var item in deadEntities.Chunk(500)) + { + _libraryManager.DeleteItemsUnsafeFast(item); + subProgress.Report(100f / deadEntities.Count * (i++ * 100)); } progress.Report(100); |
