Attempt at fixing mantis #5057 -- CPU pinned high with HGAssetBroker.
parent
6fc1ceb2ee
commit
0133619af2
|
@ -219,11 +219,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
|||
else
|
||||
asset = m_GridService.Get(id);
|
||||
|
||||
if (asset != null)
|
||||
{
|
||||
if (m_Cache != null)
|
||||
m_Cache.Cache(asset);
|
||||
}
|
||||
|
||||
return asset;
|
||||
}
|
||||
|
@ -273,18 +270,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
|||
}
|
||||
|
||||
if (IsHG(id))
|
||||
asset = m_HGService.Get(id);
|
||||
return m_HGService.GetData(id);
|
||||
else
|
||||
asset = m_GridService.Get(id);
|
||||
return m_GridService.GetData(id);
|
||||
|
||||
if (asset != null)
|
||||
{
|
||||
if (m_Cache != null)
|
||||
m_Cache.Cache(asset);
|
||||
return asset.Data;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool Get(string id, Object sender, AssetRetrieved handler)
|
||||
|
@ -304,7 +293,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
|||
{
|
||||
return m_HGService.Get(id, sender, delegate (string assetID, Object s, AssetBase a)
|
||||
{
|
||||
if (a != null && m_Cache != null)
|
||||
if (m_Cache != null)
|
||||
m_Cache.Cache(a);
|
||||
handler(assetID, s, a);
|
||||
});
|
||||
|
@ -313,7 +302,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
|||
{
|
||||
return m_GridService.Get(id, sender, delegate (string assetID, Object s, AssetBase a)
|
||||
{
|
||||
if (a != null && m_Cache != null)
|
||||
if (m_Cache != null)
|
||||
m_Cache.Cache(a);
|
||||
handler(assetID, s, a);
|
||||
});
|
||||
|
@ -331,12 +320,30 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
|||
m_Cache.Cache(asset);
|
||||
|
||||
if (asset.Temporary || asset.Local)
|
||||
{
|
||||
if (m_Cache != null)
|
||||
m_Cache.Cache(asset);
|
||||
return asset.ID;
|
||||
}
|
||||
|
||||
string id = string.Empty;
|
||||
if (IsHG(asset.ID))
|
||||
return m_HGService.Store(asset);
|
||||
id = m_HGService.Store(asset);
|
||||
else
|
||||
return m_GridService.Store(asset);
|
||||
id = m_GridService.Store(asset);
|
||||
|
||||
if (id != String.Empty)
|
||||
{
|
||||
// Placing this here, so that this work with old asset servers that don't send any reply back
|
||||
// SynchronousRestObjectRequester returns somethins that is not an empty string
|
||||
if (id != null)
|
||||
asset.ID = id;
|
||||
|
||||
if (m_Cache != null)
|
||||
m_Cache.Cache(asset);
|
||||
}
|
||||
return id;
|
||||
|
||||
}
|
||||
|
||||
public bool UpdateContent(string id, byte[] data)
|
||||
|
@ -363,10 +370,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
|||
if (m_Cache != null)
|
||||
m_Cache.Expire(id);
|
||||
|
||||
bool result = false;
|
||||
if (IsHG(id))
|
||||
return m_HGService.Delete(id);
|
||||
result = m_HGService.Delete(id);
|
||||
else
|
||||
return m_GridService.Delete(id);
|
||||
result = m_GridService.Delete(id);
|
||||
|
||||
if (result && m_Cache != null)
|
||||
m_Cache.Expire(id);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#region IHyperAssetService
|
||||
|
|
Loading…
Reference in New Issue