add GC.collect to flotsam cache expire. This is ugly but so is GC
parent
e5c2bd505c
commit
28fcbc65f9
|
@ -373,10 +373,14 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
File.SetLastAccessTime(filename, DateTime.Now);
|
File.SetLastAccessTime(filename, DateTime.Now);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch
|
catch (FileNotFoundException)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return true; // ignore other errors
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private AssetBase GetFromWeakReference(string id)
|
private AssetBase GetFromWeakReference(string id)
|
||||||
|
@ -685,8 +689,10 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
if(!Directory.Exists(dir))
|
if(!Directory.Exists(dir))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
int dirSize = 0;
|
||||||
foreach (string file in Directory.GetFiles(dir))
|
foreach (string file in Directory.GetFiles(dir))
|
||||||
{
|
{
|
||||||
|
++dirSize;
|
||||||
if (File.GetLastAccessTime(file) < purgeLine)
|
if (File.GetLastAccessTime(file) < purgeLine)
|
||||||
{
|
{
|
||||||
File.Delete(file);
|
File.Delete(file);
|
||||||
|
@ -702,11 +708,11 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
// Recurse into lower tiers
|
// Recurse into lower tiers
|
||||||
foreach (string subdir in Directory.GetDirectories(dir))
|
foreach (string subdir in Directory.GetDirectories(dir))
|
||||||
{
|
{
|
||||||
|
++dirSize;
|
||||||
CleanExpiredFiles(subdir, purgeLine);
|
CleanExpiredFiles(subdir, purgeLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a tier directory is empty, if so, delete it
|
// Check if a tier directory is empty, if so, delete it
|
||||||
int dirSize = Directory.GetFiles(dir).Length + Directory.GetDirectories(dir).Length;
|
|
||||||
if (dirSize == 0)
|
if (dirSize == 0)
|
||||||
{
|
{
|
||||||
Directory.Delete(dir);
|
Directory.Delete(dir);
|
||||||
|
@ -903,17 +909,24 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
|
|
||||||
s.ForEachSOG(delegate(SceneObjectGroup e)
|
s.ForEachSOG(delegate(SceneObjectGroup e)
|
||||||
{
|
{
|
||||||
if(!m_timerRunning && !tryGetUncached)
|
if(!m_timerRunning && !tryGetUncached || e.IsDeleted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gatherer.AddForInspection(e);
|
gatherer.AddForInspection(e);
|
||||||
gatherer.GatherAll();
|
gatherer.GatherAll();
|
||||||
|
|
||||||
if (++cooldown > 100)
|
if (++cooldown > 200)
|
||||||
{
|
{
|
||||||
|
GC.Collect();
|
||||||
|
gatherer.AssetGetCount = 0;
|
||||||
Thread.Sleep(50);
|
Thread.Sleep(50);
|
||||||
cooldown = 0;
|
cooldown = 0;
|
||||||
}
|
}
|
||||||
|
else if(gatherer.AssetGetCount > 200)
|
||||||
|
{
|
||||||
|
GC.Collect();
|
||||||
|
gatherer.AssetGetCount = 0;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if(!m_timerRunning && !tryGetUncached)
|
if(!m_timerRunning && !tryGetUncached)
|
||||||
break;
|
break;
|
||||||
|
@ -931,8 +944,10 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
cooldown += 50;
|
cooldown += 50;
|
||||||
m_AssetService.Get(idstr);
|
m_AssetService.Get(idstr);
|
||||||
}
|
}
|
||||||
if (++cooldown > 1000)
|
if (++cooldown > 500)
|
||||||
{
|
{
|
||||||
|
if(tryGetUncached)
|
||||||
|
GC.Collect();
|
||||||
Thread.Sleep(50);
|
Thread.Sleep(50);
|
||||||
cooldown = 0;
|
cooldown = 0;
|
||||||
}
|
}
|
||||||
|
@ -943,6 +958,7 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
gatherer.FailedUUIDs.Clear();
|
gatherer.FailedUUIDs.Clear();
|
||||||
gatherer.UncertainAssetsUUIDs.Clear();
|
gatherer.UncertainAssetsUUIDs.Clear();
|
||||||
|
|
||||||
|
GC.Collect();
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1149,7 +1165,7 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int assetReferenceTotal = TouchAllSceneAssets(true);
|
int assetReferenceTotal = TouchAllSceneAssets(true);
|
||||||
GC.Collect();
|
|
||||||
lock(timerLock)
|
lock(timerLock)
|
||||||
{
|
{
|
||||||
if(wasRunning)
|
if(wasRunning)
|
||||||
|
@ -1194,7 +1210,10 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (m_FileCacheEnabled)
|
if (m_FileCacheEnabled)
|
||||||
|
{
|
||||||
|
TouchAllSceneAssets(false);
|
||||||
CleanExpiredFiles(m_CacheDirectory, expirationDate);
|
CleanExpiredFiles(m_CacheDirectory, expirationDate);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
con.Output("File cache not active, not clearing.");
|
con.Output("File cache not active, not clearing.");
|
||||||
|
|
||||||
|
|
|
@ -237,6 +237,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public HashSet<UUID> UncertainAssetsUUIDs { get; private set; }
|
public HashSet<UUID> UncertainAssetsUUIDs { get; private set; }
|
||||||
public int possibleNotAssetCount { get; set; }
|
public int possibleNotAssetCount { get; set; }
|
||||||
public int ErrorCount { get; private set; }
|
public int ErrorCount { get; private set; }
|
||||||
|
public int AssetGetCount;
|
||||||
private bool verbose = true;
|
private bool verbose = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -291,6 +292,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
UncertainAssetsUUIDs = uncertainAssetsUUIDs;
|
UncertainAssetsUUIDs = uncertainAssetsUUIDs;
|
||||||
ErrorCount = 0;
|
ErrorCount = 0;
|
||||||
possibleNotAssetCount = 0;
|
possibleNotAssetCount = 0;
|
||||||
|
AssetGetCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddGathered(UUID uuid, sbyte type)
|
public bool AddGathered(UUID uuid, sbyte type)
|
||||||
|
@ -561,6 +563,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
++AssetGetCount;
|
||||||
|
|
||||||
if(UncertainAssetsUUIDs.Contains(assetUuid))
|
if(UncertainAssetsUUIDs.Contains(assetUuid))
|
||||||
UncertainAssetsUUIDs.Remove(assetUuid);
|
UncertainAssetsUUIDs.Remove(assetUuid);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue