From e0ecb3291d1ef46346a80f1e23037299893aa720 Mon Sep 17 00:00:00 2001 From: Stephan Date: Tue, 19 May 2015 10:20:36 +0200 Subject: [PATCH] XmlCache - bugfix running with file cache disabled --- .../umbraco.presentation/content.cs | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/content.cs b/src/Umbraco.Web/umbraco.presentation/content.cs index edc71ef161..b5a3d98758 100644 --- a/src/Umbraco.Web/umbraco.presentation/content.cs +++ b/src/Umbraco.Web/umbraco.presentation/content.cs @@ -40,20 +40,24 @@ namespace umbraco private content() { - if (SyncToXmlFile == false) return; - - // there's always be one task keeping a ref to the runner - // so it's safe to just create it as a local var here - var runner = new BackgroundTaskRunner(new BackgroundTaskRunnerOptions + if (XmlFileEnabled) { - LongRunning = true, - KeepAlive = true - }); + InitializeFileLock(); + } - // create (and add to runner) - _persisterTask = new XmlCacheFilePersister(runner, this); + if (SyncToXmlFile) + { + // there's always be one task keeping a ref to the runner + // so it's safe to just create it as a local var here + var runner = new BackgroundTaskRunner(new BackgroundTaskRunnerOptions + { + LongRunning = true, + KeepAlive = true + }); - InitializeFileLock(); + // create (and add to runner) + _persisterTask = new XmlCacheFilePersister(runner, this); + } // initialize content - populate the cache using (var safeXml = GetSafeXmlWriter(false)) @@ -797,7 +801,6 @@ order by umbracoNode.level, umbracoNode.sortOrder"; private void LoadXmlLocked(SafeXmlReaderWriter safeXml, out bool registerXmlChange) { LogHelper.Debug("Loading Xml..."); - EnsureFileLock(); // get the lock asap // try to get it from the file if (XmlFileEnabled && (safeXml.Xml = LoadXmlFromFile()) != null)