diff options
Diffstat (limited to 'OpenSim/Services')
-rw-r--r-- | OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 446ac71..23f2b10 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs | |||
@@ -49,6 +49,8 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
50 | public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule | 50 | public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule |
51 | { | 51 | { |
52 | private const double CACHE_EXPIRATION_SECONDS = 120.0; | ||
53 | |||
52 | private static readonly ILog m_log = | 54 | private static readonly ILog m_log = |
53 | LogManager.GetLogger( | 55 | LogManager.GetLogger( |
54 | MethodBase.GetCurrentMethod().DeclaringType); | 56 | MethodBase.GetCurrentMethod().DeclaringType); |
@@ -141,7 +143,15 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
141 | { "UserID", userID.ToString() } | 143 | { "UserID", userID.ToString() } |
142 | }; | 144 | }; |
143 | 145 | ||
144 | return GetUser(requestArgs); | 146 | account = GetUser(requestArgs); |
147 | |||
148 | if (account == null) | ||
149 | { | ||
150 | // Store null responses too, to avoid repeated lookups for missing accounts | ||
151 | m_accountCache.AddOrUpdate(userID, null, CACHE_EXPIRATION_SECONDS); | ||
152 | } | ||
153 | |||
154 | return account; | ||
145 | } | 155 | } |
146 | 156 | ||
147 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) | 157 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) |
@@ -216,7 +226,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
216 | if (success) | 226 | if (success) |
217 | { | 227 | { |
218 | // Cache the user account info | 228 | // Cache the user account info |
219 | m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromMinutes(2.0d)); | 229 | m_accountCache.AddOrUpdate(data.PrincipalID, data, CACHE_EXPIRATION_SECONDS); |
220 | } | 230 | } |
221 | else | 231 | else |
222 | { | 232 | { |
@@ -281,7 +291,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
281 | GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); | 291 | GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); |
282 | 292 | ||
283 | // Cache the user account info | 293 | // Cache the user account info |
284 | m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); | 294 | m_accountCache.AddOrUpdate(account.PrincipalID, account, CACHE_EXPIRATION_SECONDS); |
285 | 295 | ||
286 | return account; | 296 | return account; |
287 | } | 297 | } |