mantis 8890: waste CPU checking if asset id == Zero on get; several changes on region Asset connector

This commit is contained in:
UbitUmarov
2021-05-29 15:08:22 +01:00
parent 5c99e94b79
commit a23bf4eb1b
8 changed files with 158 additions and 90 deletions

View File

@@ -248,11 +248,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
}
}
if (id.Equals(Util.UUIDZeroString))
return false;
return m_AssetService.Get(id, sender, delegate (string assetID, object s, AssetBase a)
{
if ((a != null) && (m_Cache != null))
m_Cache.Cache(a);
if(m_Cache != null)
{
if (a == null)
m_Cache.CacheNegative(assetID);
else
m_Cache.Cache(a);
}
// if (null == a)
// m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not asynchronously find asset with id {0}", id);
@@ -272,18 +279,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (asset.Local)
{
// m_log.DebugFormat(
// "[LOCAL ASSET SERVICE CONNECTOR]: Returning asset {0} {1} without querying database since status Temporary = {2}, Local = {3}",
// asset.Name, asset.ID, asset.Temporary, asset.Local);
return asset.ID;
}
else
{
// m_log.DebugFormat(
// "[LOCAL ASSET SERVICE CONNECTOR]: Passing {0} {1} on to asset service for storage, status Temporary = {2}, Local = {3}",
// asset.Name, asset.ID, asset.Temporary, asset.Local);
return m_AssetService.Store(asset);
}
}

View File

@@ -305,8 +305,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
return null;
}
if(StoreOnLocalGrid)
Store(asset);
else if (m_Cache != null)
StoreLocal(asset);
if (m_Cache != null)
m_Cache.Cache(asset);
}
else if (m_Cache != null)
@@ -345,6 +345,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (asset == null)
{
if (id.Equals(Util.UUIDZeroString))
return false;
lock (m_AssetHandlers)
{
AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate (AssetBase _asset) { callBack(id, sender, _asset); });