aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
diff options
context:
space:
mode:
authorMelanie2010-09-13 16:16:40 +0100
committerMelanie2010-09-13 16:17:38 +0100
commit6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e (patch)
tree1e7bf4fddcf559886c6b2babf13cf4b2ca8829a1 /OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
parentMerge branch 'careminster-presence-refactor' of ssh://melanie@3dhosting.de/va... (diff)
parentFix unit test SceneSetupHelpers to load the mock simulation data store (diff)
downloadopensim-SC-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.zip
opensim-SC-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.tar.gz
opensim-SC-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.tar.bz2
opensim-SC-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.tar.xz
Merge branch 'master' into careminster-presence-refactor
The modules will need to be updated for this to compile and run again. Please don't use until I do the companion commit to modules later on.
Diffstat (limited to 'OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs')
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs21
1 files changed, 15 insertions, 6 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 694aa72..ddd2322 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -28,7 +28,6 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31using System.IO;
32using System.Reflection; 31using System.Reflection;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Region.Framework.Interfaces; 33using OpenSim.Region.Framework.Interfaces;
@@ -49,13 +48,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
50 public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule 49 public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule
51 { 50 {
51 private const double CACHE_EXPIRATION_SECONDS = 120.0;
52
52 private static readonly ILog m_log = 53 private static readonly ILog m_log =
53 LogManager.GetLogger( 54 LogManager.GetLogger(
54 MethodBase.GetCurrentMethod().DeclaringType); 55 MethodBase.GetCurrentMethod().DeclaringType);
55 56
56 private string m_serverUrl = String.Empty; 57 private string m_serverUrl = String.Empty;
57 private ExpiringCache<UUID, UserAccount> m_accountCache; 58 private ExpiringCache<UUID, UserAccount> m_accountCache = new ExpiringCache<UUID,UserAccount>();
58 private bool m_Enabled = false; 59 private bool m_Enabled;
59 60
60 #region ISharedRegionModule 61 #region ISharedRegionModule
61 62
@@ -141,7 +142,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
141 { "UserID", userID.ToString() } 142 { "UserID", userID.ToString() }
142 }; 143 };
143 144
144 return GetUser(requestArgs); 145 account = GetUser(requestArgs);
146
147 if (account == null)
148 {
149 // Store null responses too, to avoid repeated lookups for missing accounts
150 m_accountCache.AddOrUpdate(userID, null, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
151 }
152
153 return account;
145 } 154 }
146 155
147 public List<UserAccount> GetUserAccounts(UUID scopeID, string query) 156 public List<UserAccount> GetUserAccounts(UUID scopeID, string query)
@@ -216,7 +225,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
216 if (success) 225 if (success)
217 { 226 {
218 // Cache the user account info 227 // Cache the user account info
219 m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromMinutes(2.0d)); 228 m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
220 } 229 }
221 else 230 else
222 { 231 {
@@ -281,7 +290,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
281 GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); 290 GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName);
282 291
283 // Cache the user account info 292 // Cache the user account info
284 m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); 293 m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
285 294
286 return account; 295 return account;
287 } 296 }