Make "fache assets" console command more efficient by only updating access times on each cached asset once, not for every reference.
parent
9208fb5d54
commit
b0ff3236be
|
@ -776,8 +776,8 @@ namespace OpenSim.Region.CoreModules.Asset
|
|||
{
|
||||
UuidGatherer gatherer = new UuidGatherer(m_AssetService);
|
||||
|
||||
HashSet<UUID> uniqueUuids = new HashSet<UUID>();
|
||||
Dictionary<UUID, sbyte> assets = new Dictionary<UUID, sbyte>();
|
||||
Dictionary<UUID, sbyte> assetIdsToCheck = new Dictionary<UUID, sbyte>();
|
||||
Dictionary<UUID, bool> assetsFound = new Dictionary<UUID, bool>();
|
||||
|
||||
foreach (Scene s in m_Scenes)
|
||||
{
|
||||
|
@ -785,12 +785,12 @@ namespace OpenSim.Region.CoreModules.Asset
|
|||
|
||||
s.ForEachSOG(delegate(SceneObjectGroup e)
|
||||
{
|
||||
gatherer.GatherAssetUuids(e, assets);
|
||||
gatherer.GatherAssetUuids(e, assetIdsToCheck);
|
||||
|
||||
foreach (UUID assetID in assets.Keys)
|
||||
foreach (UUID assetID in assetIdsToCheck.Keys)
|
||||
{
|
||||
if (!assetsFound.ContainsKey(assetID))
|
||||
{
|
||||
uniqueUuids.Add(assetID);
|
||||
|
||||
string filename = GetFileName(assetID.ToString());
|
||||
|
||||
if (File.Exists(filename))
|
||||
|
@ -800,18 +800,25 @@ namespace OpenSim.Region.CoreModules.Asset
|
|||
else if (storeUncached)
|
||||
{
|
||||
AssetBase cachedAsset = m_AssetService.Get(assetID.ToString());
|
||||
if (cachedAsset == null && assets[assetID] != (sbyte)AssetType.Unknown)
|
||||
if (cachedAsset == null && assetIdsToCheck[assetID] != (sbyte)AssetType.Unknown)
|
||||
assetsFound[assetID] = false;
|
||||
else
|
||||
assetsFound[assetID] = true;
|
||||
}
|
||||
}
|
||||
else if (!assetsFound[assetID])
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[FLOTSAM ASSET CACHE]: Could not find asset {0}, type {1} referenced by object {2} at {3} in scene {4} when pre-caching all scene assets",
|
||||
assetID, assets[assetID], e.Name, e.AbsolutePosition, s.Name);
|
||||
assetID, assetIdsToCheck[assetID], e.Name, e.AbsolutePosition, s.Name);
|
||||
}
|
||||
}
|
||||
|
||||
assets.Clear();
|
||||
assetIdsToCheck.Clear();
|
||||
});
|
||||
}
|
||||
|
||||
return uniqueUuids.Count;
|
||||
return assetsFound.Count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue