stop searching for dead shortcuts over and over

This commit is contained in:
Luke Pulverenti 2014-02-26 21:44:16 -05:00
parent dfb491fcc5
commit 88965f75e2
2 changed files with 20 additions and 3 deletions

View File

@ -893,9 +893,14 @@ namespace MediaBrowser.Controller.Entities
BaseItem item = null; BaseItem item = null;
// First get using the cached Id // First get using the cached Id
if (info.ItemId != Guid.Empty) if (info.ItemId.HasValue)
{ {
item = LibraryManager.GetItemById(info.ItemId); if (info.ItemId.Value == Guid.Empty)
{
return null;
}
item = LibraryManager.GetItemById(info.ItemId.Value);
} }
// If still null, search by path // If still null, search by path
@ -908,6 +913,9 @@ namespace MediaBrowser.Controller.Entities
if (item == null) if (item == null)
{ {
Logger.Warn("Unable to find linked item at {0}", info.Path); Logger.Warn("Unable to find linked item at {0}", info.Path);
// Don't keep searching over and over
info.ItemId = Guid.Empty;
} }
else else
{ {
@ -985,6 +993,15 @@ namespace MediaBrowser.Controller.Entities
return true; return true;
} }
foreach (var child in LinkedChildren)
{
// Reset the cached value
if (child.ItemId.HasValue && child.ItemId.Value == Guid.Empty)
{
child.ItemId = null;
}
}
return false; return false;
} }

View File

@ -13,7 +13,7 @@ namespace MediaBrowser.Controller.Entities
/// Serves as a cache /// Serves as a cache
/// </summary> /// </summary>
[IgnoreDataMember] [IgnoreDataMember]
public Guid ItemId { get; set; } public Guid? ItemId { get; set; }
} }
public enum LinkedChildType public enum LinkedChildType