From bc42adb2ce0ed5c6765a38271cccd939f8b7e739 Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 16 Sep 2019 14:31:27 +1000 Subject: [PATCH] removes notifying all content/media of content type changes since nucache model creation is lazy now --- .../NuCache/PublishedSnapshotService.cs | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs index 15e6574b40..cde45ae116 100755 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs @@ -790,21 +790,22 @@ namespace Umbraco.Web.PublishedCache.NuCache Notify(_contentStore, payloads, RefreshContentTypesLocked); Notify(_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(); }