fix folder caching

This commit is contained in:
Luke Pulverenti
2016-08-15 20:22:59 -04:00
parent 02a4b90f65
commit ec111eebd3
5 changed files with 41 additions and 22 deletions

View File

@@ -33,7 +33,7 @@ namespace MediaBrowser.Controller.Entities
}
}
private void ResetCachedChildren()
private void ClearCache()
{
lock (_childIdsLock)
{
@@ -94,7 +94,7 @@ namespace MediaBrowser.Controller.Entities
public override bool BeforeMetadataRefresh()
{
ResetCachedChildren();
ClearCache();
var hasChanges = base.BeforeMetadataRefresh();
@@ -107,13 +107,22 @@ namespace MediaBrowser.Controller.Entities
return hasChanges;
}
protected override IEnumerable<BaseItem> GetNonCachedChildren(IDirectoryService directoryService)
{
ClearCache();
return base.GetNonCachedChildren(directoryService);
}
protected override async Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
{
ResetCachedChildren();
ClearCache();
await base.ValidateChildrenInternal(progress, cancellationToken, recursive, refreshChildMetadata, refreshOptions, directoryService)
.ConfigureAwait(false);
ClearCache();
// Not the best way to handle this, but it solves an issue
// CollectionFolders aren't always getting saved after changes
// This means that grabbing the item by Id may end up returning the old one