removes notifying all content/media of content type changes since nucache model creation is lazy now

This commit is contained in:
Shannon
2019-09-16 14:31:27 +10:00
parent a85d8f3e21
commit bc42adb2ce

View File

@@ -790,21 +790,22 @@ namespace Umbraco.Web.PublishedCache.NuCache
Notify<IContentType>(_contentStore, payloads, RefreshContentTypesLocked);
Notify<IMediaType>(_mediaStore, payloads, RefreshMediaTypesLocked);
if (_publishedModelFactory.IsLiveFactory())
{
//In the case of Pure Live - we actually need to refresh all of the content and the media
//see https://github.com/umbraco/Umbraco-CMS/issues/5671
//The underlying issue is that in Pure Live the ILivePublishedModelFactory will re-compile all of the classes/models
//into a new DLL for the application which includes both content types and media types.
//Since the models in the cache are based on these actual classes, all of the objects in the cache need to be updated
//to use the newest version of the class.
using (_contentStore.GetScopedWriteLock(_scopeProvider))
using (_mediaStore.GetScopedWriteLock(_scopeProvider))
{
NotifyLocked(new[] { new ContentCacheRefresher.JsonPayload(0, TreeChangeTypes.RefreshAll) }, out var draftChanged, out var publishedChanged);
NotifyLocked(new[] { new MediaCacheRefresher.JsonPayload(0, TreeChangeTypes.RefreshAll) }, out var anythingChanged);
}
}
//TODO: I don't think this is necessary with the changes to nucache now that calls to `CreateModel` are lazy!
//if (_publishedModelFactory.IsLiveFactory())
//{
// //In the case of Pure Live - we actually need to refresh all of the content and the media
// //see https://github.com/umbraco/Umbraco-CMS/issues/5671
// //The underlying issue is that in Pure Live the ILivePublishedModelFactory will re-compile all of the classes/models
// //into a new DLL for the application which includes both content types and media types.
// //Since the models in the cache are based on these actual classes, all of the objects in the cache need to be updated
// //to use the newest version of the class.
// using (_contentStore.GetScopedWriteLock(_scopeProvider))
// using (_mediaStore.GetScopedWriteLock(_scopeProvider))
// {
// NotifyLocked(new[] { new ContentCacheRefresher.JsonPayload(0, TreeChangeTypes.RefreshAll) }, out var draftChanged, out var publishedChanged);
// NotifyLocked(new[] { new MediaCacheRefresher.JsonPayload(0, TreeChangeTypes.RefreshAll) }, out var anythingChanged);
// }
//}
((PublishedSnapshot)CurrentPublishedSnapshot)?.Resync();
}