From d83cef5f3dcdccc045925bbddcadcb8b1aba952e Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Mon, 4 May 2020 09:35:48 +0200 Subject: [PATCH] Fix for tests failing --- .../PublishedSnapshotService.cs | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/Umbraco.PublishedCache.NuCache/PublishedSnapshotService.cs b/src/Umbraco.PublishedCache.NuCache/PublishedSnapshotService.cs index 7f78ecd5cf..e5f3ffaa6a 100644 --- a/src/Umbraco.PublishedCache.NuCache/PublishedSnapshotService.cs +++ b/src/Umbraco.PublishedCache.NuCache/PublishedSnapshotService.cs @@ -900,23 +900,15 @@ namespace Umbraco.Web.PublishedCache.NuCache // we ran this on a background thread then those cache refreshers are going to not get 'live' data when they query the content cache which // they require. - // These can be run side by side in parallel. - - Parallel.Invoke( - () => - { - using (_contentStore.GetScopedWriteLock(_scopeProvider)) - { - NotifyLocked(new[] { new ContentCacheRefresher.JsonPayload(0, null, TreeChangeTypes.RefreshAll) }, out _, out _); - } - }, - () => - { - using (_mediaStore.GetScopedWriteLock(_scopeProvider)) - { - NotifyLocked(new[] { new MediaCacheRefresher.JsonPayload(0, null, TreeChangeTypes.RefreshAll) }, out _); - } - }); + // These cannot currently be run side by side in parallel, due to the monitors need to be exits my the same thread that enter them. + using (_contentStore.GetScopedWriteLock(_scopeProvider)) + { + NotifyLocked(new[] { new ContentCacheRefresher.JsonPayload(0, null, TreeChangeTypes.RefreshAll) }, out _, out _); + } + using (_mediaStore.GetScopedWriteLock(_scopeProvider)) + { + NotifyLocked(new[] { new MediaCacheRefresher.JsonPayload(0, null, TreeChangeTypes.RefreshAll) }, out _); + } } ((PublishedSnapshot)CurrentPublishedSnapshot)?.Resync();