U4-11527 Fix concurrency issue

This commit is contained in:
Pavel Budik
2018-08-08 10:02:48 +02:00
parent abb88f20f9
commit 3efbb47aed
2 changed files with 11 additions and 12 deletions

View File

@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using Semver;
using System;
using System.Collections.Concurrent;
using System.Configuration;
using System.Threading;
using Semver;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core.ObjectResolution;
@@ -13,7 +13,7 @@ using Umbraco.Core.Sync;
namespace Umbraco.Core
{
/// <summary>
/// <summary>
/// the Umbraco Application context
/// </summary>
/// <remarks>
@@ -270,7 +270,7 @@ namespace Umbraco.Core
return _umbracoApplicationUrl;
}
}
/// <summary>
/// Resets the url.
/// </summary>
@@ -280,10 +280,10 @@ namespace Umbraco.Core
}
// ReSharper disable once InconsistentNaming
internal string _umbracoApplicationUrl;
internal List<string> _umbracoApplicationDomains = new List<string>();
internal string _umbracoApplicationUrl;
internal ConcurrentDictionary<string, string> _umbracoApplicationDomains = new ConcurrentDictionary<string, string>();
internal string _umbracoApplicationDeploymentId;
private Lazy<bool> _configured;
@@ -399,7 +399,7 @@ namespace Umbraco.Core
}
return version;
}
}
private void AssertIsNotReady()
{

View File

@@ -51,10 +51,9 @@ namespace Umbraco.Core.Sync
if (request != null)
{
var applicationUrl = GetApplicationUrlFromRequest(request);
newApplicationUrl = !appContext._umbracoApplicationDomains.Contains(applicationUrl);
newApplicationUrl = appContext._umbracoApplicationDomains.TryAdd(applicationUrl, applicationUrl);
if (newApplicationUrl)
{
appContext._umbracoApplicationDomains.Add(applicationUrl);
LogHelper.Info(typeof(ApplicationUrlHelper), string.Format("New ApplicationUrl detected: {0}", applicationUrl));
}
}