diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 863560b5e2..c48186fdab 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -203,21 +203,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory void OnClientClosed(UUID clientID, Scene scene) { - if (m_InventoryURLs.ContainsKey(clientID)) // if it's in cache + ScenePresence sp = null; + foreach (Scene s in m_Scenes) { - ScenePresence sp = null; - foreach (Scene s in m_Scenes) + s.TryGetScenePresence(clientID, out sp); + if ((sp != null) && !sp.IsChildAgent && (s != scene)) { - s.TryGetScenePresence(clientID, out sp); - if ((sp != null) && !sp.IsChildAgent && (s != scene)) - { - m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping inventoryURL in cache", + m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping inventoryURL in cache", scene.RegionInfo.RegionName, clientID); return; - } } - DropInventoryServiceURL(clientID); } + + if (m_InventoryURLs.ContainsKey(clientID)) // if it's in cache + DropInventoryServiceURL(clientID); + + m_Cache.RemoveAll(clientID); } /// diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index 3195e6b872..f7ef2eaa53 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs @@ -38,12 +38,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// public class InventoryCache { - private const double CACHE_EXPIRATION_SECONDS = 3600.0; // 1 hour + private const double CACHE_EXPIRATION_SECONDS = 60.0; // 1 minute private static ExpiringCache m_RootFolders = new ExpiringCache(); private static ExpiringCache> m_FolderTypes = new ExpiringCache>(); private static ExpiringCache m_Inventories = new ExpiringCache(); + + public void RemoveAll(UUID userID) + { + if(m_RootFolders.Contains(userID)) + m_RootFolders.Remove(userID); + if(m_FolderTypes.Contains(userID)) + m_FolderTypes.Remove(userID); + if(m_Inventories.Contains(userID)) + m_Inventories.Remove(userID); + } + public void Cache(UUID userID, InventoryFolderBase root) { m_RootFolders.AddOrUpdate(userID, root, CACHE_EXPIRATION_SECONDS);