Compare commits

..

3 Commits

Author SHA1 Message Date
UbitUmarov
d829644650 reduce unnecessary saves of attachments a bit 2026-06-20 01:34:33 +01:00
UbitUmarov
effb5784c1 a few changes on assets store and exists return 2026-06-19 22:47:12 +01:00
UbitUmarov
7130e30483 increase asset store web timeout to 30s again 2026-06-19 21:39:58 +01:00
11 changed files with 29 additions and 35 deletions

View File

@@ -253,7 +253,7 @@ namespace OpenSim.Data.MySQL
public override bool[] AssetsExist(UUID[] uuids)
{
if (uuids.Length == 0)
return new bool[0];
return [];
HashSet<UUID> exist = new HashSet<UUID>();

View File

@@ -401,7 +401,7 @@ namespace OpenSim.Data.MySQL
public bool[] AssetsExist(UUID[] uuids)
{
if (uuids.Length == 0)
return new bool[0];
return [];
HashSet<UUID> exists = new HashSet<UUID>();

View File

@@ -239,7 +239,7 @@ namespace OpenSim.Data.PGSQL
public override bool[] AssetsExist(UUID[] uuids)
{
if (uuids.Length == 0)
return new bool[0];
return [];
HashSet<UUID> exist = new HashSet<UUID>();

View File

@@ -147,7 +147,8 @@ namespace OpenSim.Data.SQLite
}
//m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString());
if (AssetsExist(new[] { asset.FullID })[0])
bool[] assetsExist = AssetsExist([ asset.FullID ]);
if (assetsExist.Length > 0 && assetsExist[0])
{
//LogAssetLoad(asset);
@@ -218,7 +219,7 @@ namespace OpenSim.Data.SQLite
public override bool[] AssetsExist(UUID[] uuids)
{
if (uuids.Length == 0)
return new bool[0];
return [];
HashSet<UUID> exist = new HashSet<UUID>();

View File

@@ -1008,6 +1008,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
/// <param name="saveAllScripted"></param>
private void UpdateKnownItem(IScenePresence sp, SceneObjectGroup grp, string scriptedState)
{
if (sp.IsNPC)
return;
if (m_invAccessModule is null)
return;
if(!grp.HasGroupChanged)
{
if (DebugLevel > 0)
@@ -1020,20 +1026,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
grp.HasGroupChanged = false;
if (m_invAccessModule is null)
return;
if (grp.FromItemID.IsZero())
{
// We can't save temp attachments
return;
}
if (sp.IsNPC)
{
return;
}
m_log.Debug($"[ATTACHMENTS MODULE]: Updating asset for attachment {grp.UUID}, attachpoint {grp.AttachmentPoint}");
InventoryItemBase item = m_scene.InventoryService.GetItem(sp.UUID, grp.FromItemID);
@@ -1153,6 +1151,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
so.IsSelected = false; // fudge....
so.ScheduleGroupForUpdate(PrimUpdateFlags.FullUpdatewithAnimMatOvr);
so.HasGroupChanged = false;
}
// In case it is later dropped again, don't let

View File

@@ -314,8 +314,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
public string Store(AssetBase asset)
{
if (m_Cache != null)
m_Cache.Cache(asset);
m_Cache?.Cache(asset);
if (asset.Local)
{

View File

@@ -512,7 +512,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
return m_localConnector.AssetsExist(ids);
else if (m_HGConnector != null)
return m_HGConnector.AssetsExist(ids);
return null;
return [];
}
public string Store(AssetBase asset)
@@ -524,12 +524,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
return null;
id = StoreForeign(asset);
if (m_Cache != null)
{
if (!string.IsNullOrEmpty(id) && !id.Equals(UUID.ZeroString))
m_Cache.Cache(asset);
if (!string.IsNullOrEmpty(id) && !id.Equals(UUID.ZeroString))
{
m_Cache?.Cache(asset);
return id;
}
return id;
else
return string.Empty;
}
if (m_Cache != null)
@@ -541,10 +542,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
id = StoreLocal(asset);
if (string.IsNullOrEmpty(id))
return string.Empty;
return id;
return string.IsNullOrEmpty(id) || id.Equals(UUID.ZeroString) ? string.Empty : id;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]

View File

@@ -451,7 +451,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
assetStrings[k], existChecks[k] ? "yes" : "no");
sb.Append(cdt.ToString());
sb.Append("\n");
sb.Append('\n');
}
}
else

View File

@@ -168,15 +168,13 @@ namespace OpenSim.Services.AssetService
public virtual string Store(AssetBase asset)
{
bool exists = m_Database.AssetsExist(new[] { asset.FullID })[0];
if (!exists)
bool[] assetsexist = m_Database.AssetsExist([ asset.FullID ] );
if (assetsexist.Length == 0 || !assetsexist[0])
{
// m_log.DebugFormat(
// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length);
if (!m_Database.StoreAsset(asset))
{
return UUID.Zero.ToString();
}
return UUID.Zero.ToString();
}
// else
// {

View File

@@ -187,9 +187,8 @@ namespace OpenSim.Services.AssetService
public virtual string Store(AssetBase asset)
{
bool exists = m_Database.AssetsExist(new[] { asset.FullID })[0];
if (!exists)
{
bool[] assetsexist = m_Database.AssetsExist([ asset.FullID ] );
if (assetsexist.Length == 0 || !assetsexist[0]) {
// m_log.DebugFormat(
// "[XASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length);
m_Database.StoreAsset(asset);

View File

@@ -359,7 +359,7 @@ namespace OpenSim.Services.Connectors
string newID;
try
{
newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset, 10000, m_Auth);
newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset, 30000, m_Auth);
}
catch
{