diff --git a/src/Umbraco.Core/Sync/WebServiceServerMessenger.cs b/src/Umbraco.Core/Sync/WebServiceServerMessenger.cs index c4b3c03d2f..1c63b591b7 100644 --- a/src/Umbraco.Core/Sync/WebServiceServerMessenger.cs +++ b/src/Umbraco.Core/Sync/WebServiceServerMessenger.cs @@ -126,8 +126,8 @@ namespace Umbraco.Core.Sync public static string GetServerHash(string machineName, string appDomainAppId) { var hasher = new HashCodeCombiner(); - hasher.AddCaseInsensitiveString(NetworkHelper.MachineName); - hasher.AddCaseInsensitiveString(System.Web.HttpRuntime.AppDomainAppId); + hasher.AddCaseInsensitiveString(appDomainAppId); + hasher.AddCaseInsensitiveString(machineName); return hasher.GetCombinedHashCode(); } diff --git a/src/Umbraco.Tests/Cache/CacheRefresherTests.cs b/src/Umbraco.Tests/Cache/CacheRefresherTests.cs index 690ad80525..33dfd16743 100644 --- a/src/Umbraco.Tests/Cache/CacheRefresherTests.cs +++ b/src/Umbraco.Tests/Cache/CacheRefresherTests.cs @@ -1,3 +1,4 @@ +using System; using NUnit.Framework; using Umbraco.Core.Sync; using umbraco.presentation.webservices; @@ -9,16 +10,22 @@ namespace Umbraco.Tests.Cache { [TestCase("", "123456", "testmachine", true)] //empty hash will continue [TestCase("fffffff28449cf33", "123456", "testmachine", false)] //match, don't continue - [TestCase("fffffff28449cf33", "12345", "testmachine", true)] - [TestCase("fffffff28449cf33", "123456", "testmachin", true)] - [TestCase("fffffff28449cf3", "123456", "testmachine", true)] + [TestCase("fffffff28449cf33", "12345", "testmachine", true)] // no match, continue + [TestCase("fffffff28449cf33", "123456", "testmachin", true)] // same + [TestCase("fffffff28449cf3", "123456", "testmachine", true)] // same public void Continue_Refreshing_For_Request(string hash, string appDomainAppId, string machineName, bool expected) { if (expected) - Assert.AreEqual(hash, WebServiceServerMessenger.GetServerHash(appDomainAppId, machineName)); + Assert.IsTrue(Continue(hash, WebServiceServerMessenger.GetServerHash(appDomainAppId, machineName))); else - Assert.AreNotEqual(hash, WebServiceServerMessenger.GetServerHash(appDomainAppId, machineName)); + Assert.IsFalse(Continue(hash, WebServiceServerMessenger.GetServerHash(appDomainAppId, machineName))); } + // that's what CacheRefresher.asmx.cs does... + private bool Continue(string hash1, string hash2) + { + if (string.IsNullOrEmpty(hash1)) return true; + return hash1 != hash2; + } } } \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/CacheRefresher.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/CacheRefresher.asmx.cs index 4186b2446a..5cfb8d3393 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/CacheRefresher.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/CacheRefresher.asmx.cs @@ -24,6 +24,7 @@ namespace umbraco.presentation.webservices // in which case we should ignore the message because it's been processed locally already internal static bool SelfMessage(string hash) { + if (string.IsNullOrEmpty(hash)) return false; // no hash = don't know = not self if (hash != WebServiceServerMessenger.GetCurrentServerHash()) return false; LogHelper.Debug(