mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 03:45:35 +08:00
mantis 8890: waste CPU checking if asset id == Zero on get; several changes on region Asset connector
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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); });
|
||||
|
||||
Reference in New Issue
Block a user