remove people refresh retry

This commit is contained in:
Luke Pulverenti
2016-08-04 00:38:58 -04:00
parent e08f5d5d61
commit 39245133f8
9 changed files with 16 additions and 133 deletions
@@ -89,7 +89,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
var peopleOptions = _config.Configuration.PeopleMetadataOptions;
var people = _libraryManager.GetAllPeople();
var people = _libraryManager.GetPeople(new InternalPeopleQuery());
var dict = new Dictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
@@ -112,8 +112,9 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
}
var numComplete = 0;
var validIds = new List<Guid>();
_logger.Debug("Will refresh {0} people", dict.Count);
foreach (var person in dict)
{
cancellationToken.ThrowIfCancellationRequested();
@@ -122,10 +123,9 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
{
var item = _libraryManager.GetPerson(person.Key);
validIds.Add(item.Id);
var hasMetdata = !string.IsNullOrWhiteSpace(item.Overview);
var performFullRefresh = !hasMetdata && (DateTime.UtcNow - item.DateLastRefreshed).TotalDays >= 30;
var performFullRefresh = !hasMetdata && (DateTime.UtcNow - item.DateLastRefreshed).TotalDays >= 90;
performFullRefresh = false;
var defaultMetadataRefreshMode = performFullRefresh
? MetadataRefreshMode.FullRefresh
@@ -160,31 +160,6 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
progress.Report(100 * percent);
}
var allIds = _libraryManager.GetItemIds(new InternalItemsQuery
{
IncludeItemTypes = new[] { typeof(Person).Name }
});
var invalidIds = allIds
.Except(validIds)
.ToList();
foreach (var id in invalidIds)
{
cancellationToken.ThrowIfCancellationRequested();
var item = _libraryManager.GetItemById(id);
if (item != null)
{
await _libraryManager.DeleteItem(item, new DeleteOptions
{
DeleteFileLocation = false
}).ConfigureAwait(false);
}
}
progress.Report(100);
_logger.Info("People validation complete");