only run identity providers if refreshing metadata

This commit is contained in:
Luke Pulverenti 2014-08-21 12:21:39 -04:00
parent 76ed60605b
commit 88fce3670a
2 changed files with 8 additions and 13 deletions

View File

@ -103,9 +103,6 @@ namespace MediaBrowser.Providers.Manager
refreshResult.AddStatus(ProviderRefreshStatus.Failure, ex.Message); refreshResult.AddStatus(ProviderRefreshStatus.Failure, ex.Message);
} }
// Identify item
TIdType id = null;
// Next run metadata providers // Next run metadata providers
if (refreshOptions.MetadataRefreshMode != MetadataRefreshMode.None) if (refreshOptions.MetadataRefreshMode != MetadataRefreshMode.None)
{ {
@ -122,23 +119,19 @@ namespace MediaBrowser.Providers.Manager
if (providers.Count > 0) if (providers.Count > 0)
{ {
id = await CreateInitialLookupInfo(itemOfType, cancellationToken).ConfigureAwait(false); var id = await CreateInitialLookupInfo(itemOfType, cancellationToken).ConfigureAwait(false);
var result = await RefreshWithProviders(itemOfType, id, refreshOptions, providers, itemImageProvider, cancellationToken).ConfigureAwait(false); var result = await RefreshWithProviders(itemOfType, id, refreshOptions, providers, itemImageProvider, cancellationToken).ConfigureAwait(false);
updateType = updateType | result.UpdateType; updateType = updateType | result.UpdateType;
refreshResult.AddStatus(result.Status, result.ErrorMessage); refreshResult.AddStatus(result.Status, result.ErrorMessage);
refreshResult.SetDateLastMetadataRefresh(DateTime.UtcNow); refreshResult.SetDateLastMetadataRefresh(DateTime.UtcNow);
refreshResult.AddImageProvidersRefreshed(result.Providers); refreshResult.AddImageProvidersRefreshed(result.Providers);
MergeIdentities(itemOfType, id);
} }
} }
if (id == null)
{
id = await CreateInitialLookupInfo(itemOfType, cancellationToken).ConfigureAwait(false);
}
MergeIdentities(itemOfType, id);
// Next run remote image providers, but only if local image providers didn't throw an exception // Next run remote image providers, but only if local image providers didn't throw an exception
if (!localImagesFailed && refreshOptions.ImageRefreshMode != ImageRefreshMode.ValidationOnly) if (!localImagesFailed && refreshOptions.ImageRefreshMode != ImageRefreshMode.ValidationOnly)
{ {
@ -491,7 +484,7 @@ namespace MediaBrowser.Providers.Manager
{ {
try try
{ {
//await hasIdentity.FindIdentities(ProviderManager, cancellationToken).ConfigureAwait(false); await hasIdentity.FindIdentities(ProviderManager, cancellationToken).ConfigureAwait(false);
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -251,7 +251,9 @@ namespace MediaBrowser.Server.Implementations.Dto
dto.ChildCount = GetChildCount(folder, user); dto.ChildCount = GetChildCount(folder, user);
if (!(folder is UserRootFolder)) // These are just far too slow.
// TODO: Disable for CollectionFolder
if (!(folder is UserRootFolder) && !(folder is UserView))
{ {
SetSpecialCounts(folder, user, dto, fields); SetSpecialCounts(folder, user, dto, fields);
} }