Compare commits

...

1 Commits

Author SHA1 Message Date
UbitUmarov
effb5784c1 a few changes on assets store and exists return 2026-06-19 22:47:12 +01:00
9 changed files with 21 additions and 26 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

@@ -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);