drasticly reduce HG inventory caches Expire times, Remove them all onClientClose. This to avoid potencial desyncs with inventory service

LSLKeyTest
UbitUmarov 2016-08-16 23:11:01 +01:00
parent 544b859c00
commit 72876fc683
2 changed files with 22 additions and 10 deletions

View File

@ -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);
}
/// <summary>

View File

@ -38,12 +38,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
/// </summary>
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<UUID, InventoryFolderBase> m_RootFolders = new ExpiringCache<UUID, InventoryFolderBase>();
private static ExpiringCache<UUID, Dictionary<FolderType, InventoryFolderBase>> m_FolderTypes = new ExpiringCache<UUID, Dictionary<FolderType, InventoryFolderBase>>();
private static ExpiringCache<UUID, InventoryCollection> m_Inventories = new ExpiringCache<UUID, InventoryCollection>();
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);