From 3d3eec436a42ced82b51ac11d03c2d98cc3d729a Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Sun, 20 Apr 2008 20:36:06 +0000 Subject: [PATCH] * Remove user profile from cache when they log out from a region. * A much more significant fix is required to clean up the cache when a user moves out of a region, but really better handling of delayed inventory cache updates needs to be written first, and possibly better affinity to cut down agent inventory requests when the move is between two regions hosted on the same server. --- .../Cache/UserProfileCacheService.cs | 25 ++++++++++++++++++- .../Framework/Communications/LoginResponse.cs | 2 +- .../InventoryServer/GridInventoryService.cs | 2 +- OpenSim/Region/Environment/Scenes/Scene.cs | 2 ++ 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index a9e2780dfd..9813756469 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs @@ -86,7 +86,30 @@ namespace OpenSim.Framework.Communications.Cache } } } - } + } + + /// + /// Remove this user's profile cache. + /// + /// + /// true if the user was successfully removed, false otherwise + public bool RemoveUser(LLUUID userID) + { + lock (m_userProfiles) + { + if (m_userProfiles.ContainsKey(userID)) + { + m_userProfiles.Remove(userID); + return true; + } + else + { + m_log.WarnFormat("[USER CACHE]: Tried to remove the profile of user {0}, but this was not in the scene", userID); + } + } + + return false; + } /// /// Request the inventory data for the given user. This will occur asynchronously if running on a grid diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs index 9636d167fd..1b88d1019c 100644 --- a/OpenSim/Framework/Communications/LoginResponse.cs +++ b/OpenSim/Framework/Communications/LoginResponse.cs @@ -247,7 +247,7 @@ namespace OpenSim.Framework.UserManagement { return GenerateFailureResponse( "key", - "The agent inventory service is not responding. Please notify your region operator.", + "The agent inventory service is not responding. Please notify your login region operator.", "false"); } diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs index 8a45badc20..f7c9828340 100644 --- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs +++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs @@ -110,7 +110,7 @@ namespace OpenSim.Grid.InventoryServer public InventoryCollection GetUserInventory(Guid rawUserID) { // uncomment me to simulate an overloaded inventory server - //Thread.Sleep(40000); + //Thread.Sleep(25000); LLUUID userID = new LLUUID(rawUserID); diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index c5ed958ebc..a3f6948960 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1696,6 +1696,8 @@ namespace OpenSim.Region.Environment.Scenes m_sceneGridService.SendCloseChildAgentConnections(agentID, childknownRegions); RemoveCapsHandler(agentID); + + CommsManager.UserProfileCacheService.RemoveUser(agentID); } m_eventManager.TriggerClientClosed(agentID);