stop searching for dead shortcuts over and over

pull/702/head
Luke Pulverenti 11 years ago
parent dfb491fcc5
commit 88965f75e2

@ -893,9 +893,14 @@ namespace MediaBrowser.Controller.Entities
BaseItem item = null;
// 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
@ -908,6 +913,9 @@ namespace MediaBrowser.Controller.Entities
if (item == null)
{
Logger.Warn("Unable to find linked item at {0}", info.Path);
// Don't keep searching over and over
info.ItemId = Guid.Empty;
}
else
{
@ -985,6 +993,15 @@ namespace MediaBrowser.Controller.Entities
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;
}

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

Loading…
Cancel
Save