diff options
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.cs | 21 |
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 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Collections.Specialized; | 30 | using System.Collections.Specialized; |
31 | using System.IO; | ||
32 | using System.Reflection; | 31 | using System.Reflection; |
33 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
34 | using OpenSim.Region.Framework.Interfaces; | 33 | using 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 | } |