adds appSetting to switch maindom lock

This commit is contained in:
Shannon
2019-12-10 13:42:53 +01:00
parent 1513a12549
commit 654511a656
2 changed files with 16 additions and 2 deletions

View File

@@ -9,6 +9,8 @@ namespace Umbraco.Core
/// </summary>
public static class AppSettings
{
public const string MainDomLock = "Umbraco.Core.MainDom.Lock";
// TODO: Kill me - still used in Umbraco.Core.IO.SystemFiles:27
[Obsolete("We need to kill this appsetting as we do not use XML content cache umbraco.config anymore due to NuCache")]
public const string ContentXML = "Umbraco.Core.ContentXML"; //umbracoContentXML

View File

@@ -1,7 +1,9 @@
using System.Threading;
using System.Configuration;
using System.Threading;
using System.Web;
using Umbraco.Core;
using Umbraco.Core.Logging.Serilog;
using Umbraco.Core.Runtime;
using Umbraco.Web.Runtime;
namespace Umbraco.Web
@@ -14,7 +16,17 @@ namespace Umbraco.Web
protected override IRuntime GetRuntime()
{
var logger = SerilogLogger.CreateWithDefaultConfiguration();
return new WebRuntime(this, logger, new MainDom(logger));
// Determine if we should use the sql main dom or the default
var appSettingMainDomLock = ConfigurationManager.AppSettings[Constants.AppSettings.MainDomLock];
var mainDomLock = appSettingMainDomLock == "SqlMainDomLock"
? (IMainDomLock)new SqlMainDomLock(logger)
: new MainDomSemaphoreLock();
var runtime = new WebRuntime(this, logger, new MainDom(logger, mainDomLock));
return runtime;
}
/// <summary>