From 09534f378e7362137f5fcfc18f56bd3eb8cd1ce6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 28 Nov 2014 01:16:30 +0000 Subject: Avoid repeated lag-generating continuous attempts to retrieve HG service Urls in UMM if the initial request fails, possibly due to the home URL not being present Instead, the failure information is effectively added to the memory cache (so no persistence over simualtor sessions). A future improvement may be to invalidate negative cache results after some time has passed in case the failure was transient. Looks to resolve http://opensimulator.org/mantis/view.php?id=7382 --- .../Framework/UserManagement/UserManagementModule.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 8892623..9bf7885 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -462,12 +462,14 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement { // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Requested url type {0} for {1}", serverType, userID); - if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null) + if (userdata.ServerURLs != null) { - return userdata.ServerURLs[serverType].ToString(); - } + object url; - if (!string.IsNullOrEmpty(userdata.HomeURL)) + if (userdata.ServerURLs.TryGetValue(serverType, out url)) + return url.ToString(); + } + else if (!string.IsNullOrEmpty(userdata.HomeURL)) { //m_log.DebugFormat( // "[USER MANAGEMENT MODULE]: Did not find url type {0} so requesting urls from '{1}' for {2}", @@ -483,9 +485,11 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement m_log.Debug("[USER MANAGEMENT MODULE]: GetServerURLs call failed ", e); userdata.ServerURLs = new Dictionary(); } - - if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null) - return userdata.ServerURLs[serverType].ToString(); + + object url; + + if (userdata.ServerURLs.TryGetValue(serverType, out url)) + return url.ToString(); } } -- cgit v1.1