drasticly reduce HG inventory caches Expire times, Remove them all onClientClose. This to avoid potencial desyncs with inventory service
parent
544b859c00
commit
72876fc683
|
@ -203,21 +203,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
|
|
||||||
void OnClientClosed(UUID clientID, Scene scene)
|
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;
|
s.TryGetScenePresence(clientID, out sp);
|
||||||
foreach (Scene s in m_Scenes)
|
if ((sp != null) && !sp.IsChildAgent && (s != scene))
|
||||||
{
|
{
|
||||||
s.TryGetScenePresence(clientID, out sp);
|
m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping inventoryURL in cache",
|
||||||
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",
|
|
||||||
scene.RegionInfo.RegionName, clientID);
|
scene.RegionInfo.RegionName, clientID);
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
DropInventoryServiceURL(clientID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_InventoryURLs.ContainsKey(clientID)) // if it's in cache
|
||||||
|
DropInventoryServiceURL(clientID);
|
||||||
|
|
||||||
|
m_Cache.RemoveAll(clientID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -38,12 +38,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class InventoryCache
|
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, 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, Dictionary<FolderType, InventoryFolderBase>> m_FolderTypes = new ExpiringCache<UUID, Dictionary<FolderType, InventoryFolderBase>>();
|
||||||
private static ExpiringCache<UUID, InventoryCollection> m_Inventories = new ExpiringCache<UUID, InventoryCollection>();
|
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)
|
public void Cache(UUID userID, InventoryFolderBase root)
|
||||||
{
|
{
|
||||||
m_RootFolders.AddOrUpdate(userID, root, CACHE_EXPIRATION_SECONDS);
|
m_RootFolders.AddOrUpdate(userID, root, CACHE_EXPIRATION_SECONDS);
|
||||||
|
|
Loading…
Reference in New Issue