put back diva's cache with her recent fix but also avoid duplicated InventoryService.UpdateItem call in case of m_uploadState is complete. In that case CompleteItemUpload will do it

avinationmerge
UbitUmarov 2015-09-11 22:26:05 +01:00
parent 08187cb599
commit 410ae96d04
2 changed files with 33 additions and 11 deletions

View File

@ -337,12 +337,16 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
m_asset.Description = item.Description; m_asset.Description = item.Description;
m_asset.Type = (sbyte)item.AssetType; m_asset.Type = (sbyte)item.AssetType;
// We must always store the item at this point even if the asset hasn't finished uploading, in order // remove redundante m_Scene.InventoryService.UpdateItem
// to avoid a race condition when the appearance module retrieves the item to set the asset id in // if uploadState == UploadState.Complete)
// the AvatarAppearance structure. // if (m_asset.FullID != UUID.Zero)
item.AssetID = m_asset.FullID; // {
if (item.AssetID != UUID.Zero) // We must always store the item at this point even if the asset hasn't finished uploading, in order
m_Scene.InventoryService.UpdateItem(item); // to avoid a race condition when the appearance module retrieves the item to set the asset id in
// the AvatarAppearance structure.
// item.AssetID = m_asset.FullID;
// m_Scene.InventoryService.UpdateItem(item);
// }
if (m_uploadState == UploadState.Complete) if (m_uploadState == UploadState.Complete)
{ {
@ -350,9 +354,20 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
} }
else else
{ {
// m_log.DebugFormat( // do it here to avoid the eventual race condition
// "[ASSET XFER UPLOADER]: Holding update inventory item request {0} for {1} pending completion of asset xfer for transaction {2}", if (m_asset.FullID != UUID.Zero)
// item.Name, remoteClient.Name, transactionID); {
// We must always store the item at this point even if the asset hasn't finished uploading, in order
// to avoid a race condition when the appearance module retrieves the item to set the asset id in
// the AvatarAppearance structure.
item.AssetID = m_asset.FullID;
m_Scene.InventoryService.UpdateItem(item);
}
// m_log.DebugFormat(
// "[ASSET XFER UPLOADER]: Holding update inventory item request {0} for {1} pending completion of asset xfer for transaction {2}",
// item.Name, remoteClient.Name, transactionID);
m_updateItem = true; m_updateItem = true;
m_updateItemData = item; m_updateItemData = item;

View File

@ -474,7 +474,13 @@ namespace OpenSim.Services.Connectors
{ "CreationDate", item.CreationDate.ToString() } { "CreationDate", item.CreationDate.ToString() }
}); });
return CheckReturn(ret); bool result = CheckReturn(ret);
if (result)
{
m_ItemCache.AddOrUpdate(item.ID, item, CACHE_EXPIRATION_SECONDS);
}
return result;
} }
public bool MoveItems(UUID principalID, List<InventoryItemBase> items) public bool MoveItems(UUID principalID, List<InventoryItemBase> items)
@ -551,6 +557,7 @@ namespace OpenSim.Services.Connectors
List<UUID> pending = new List<UUID>(); List<UUID> pending = new List<UUID>();
InventoryItemBase item = null; InventoryItemBase item = null;
int i = 0; int i = 0;
foreach (UUID id in itemIDs) foreach (UUID id in itemIDs)
{ {
if (m_ItemCache.TryGetValue(id, out item)) if (m_ItemCache.TryGetValue(id, out item))