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
|
else
|
||||||
asset = m_GridService.Get(id);
|
asset = m_GridService.Get(id);
|
||||||
|
|
||||||
if (asset != null)
|
|
||||||
{
|
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
m_Cache.Cache(asset);
|
m_Cache.Cache(asset);
|
||||||
}
|
|
||||||
|
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
|
@ -273,18 +270,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsHG(id))
|
if (IsHG(id))
|
||||||
asset = m_HGService.Get(id);
|
return m_HGService.GetData(id);
|
||||||
else
|
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)
|
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)
|
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);
|
m_Cache.Cache(a);
|
||||||
handler(assetID, s, 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)
|
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);
|
m_Cache.Cache(a);
|
||||||
handler(assetID, s, a);
|
handler(assetID, s, a);
|
||||||
});
|
});
|
||||||
|
@ -331,12 +320,30 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
m_Cache.Cache(asset);
|
m_Cache.Cache(asset);
|
||||||
|
|
||||||
if (asset.Temporary || asset.Local)
|
if (asset.Temporary || asset.Local)
|
||||||
|
{
|
||||||
|
if (m_Cache != null)
|
||||||
|
m_Cache.Cache(asset);
|
||||||
return asset.ID;
|
return asset.ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
string id = string.Empty;
|
||||||
if (IsHG(asset.ID))
|
if (IsHG(asset.ID))
|
||||||
return m_HGService.Store(asset);
|
id = m_HGService.Store(asset);
|
||||||
else
|
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)
|
public bool UpdateContent(string id, byte[] data)
|
||||||
|
@ -363,10 +370,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
m_Cache.Expire(id);
|
m_Cache.Expire(id);
|
||||||
|
|
||||||
|
bool result = false;
|
||||||
if (IsHG(id))
|
if (IsHG(id))
|
||||||
return m_HGService.Delete(id);
|
result = m_HGService.Delete(id);
|
||||||
else
|
else
|
||||||
return m_GridService.Delete(id);
|
result = m_GridService.Delete(id);
|
||||||
|
|
||||||
|
if (result && m_Cache != null)
|
||||||
|
m_Cache.Expire(id);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IHyperAssetService
|
#region IHyperAssetService
|
||||||
|
|
Loading…
Reference in New Issue