diff options
author | UbitUmarov | 2015-09-11 22:26:05 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-11 22:26:05 +0100 |
commit | 410ae96d044f234f35a0824d934d72e77155d62f (patch) | |
tree | dc2614ce196230120e7a222254ae15648c542d41 | |
parent | inventory mess return to the state before divas cache issue (diff) | |
download | opensim-SC-410ae96d044f234f35a0824d934d72e77155d62f.zip opensim-SC-410ae96d044f234f35a0824d934d72e77155d62f.tar.gz opensim-SC-410ae96d044f234f35a0824d934d72e77155d62f.tar.bz2 opensim-SC-410ae96d044f234f35a0824d934d72e77155d62f.tar.xz |
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
-rw-r--r-- | OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs | 35 | ||||
-rw-r--r-- | OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs | 9 |
2 files changed, 33 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs index fdff199..fabb409 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs | |||
@@ -337,12 +337,16 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
337 | m_asset.Description = item.Description; | 337 | m_asset.Description = item.Description; |
338 | m_asset.Type = (sbyte)item.AssetType; | 338 | m_asset.Type = (sbyte)item.AssetType; |
339 | 339 | ||
340 | // We must always store the item at this point even if the asset hasn't finished uploading, in order | 340 | // remove redundante m_Scene.InventoryService.UpdateItem |
341 | // to avoid a race condition when the appearance module retrieves the item to set the asset id in | 341 | // if uploadState == UploadState.Complete) |
342 | // the AvatarAppearance structure. | 342 | // if (m_asset.FullID != UUID.Zero) |
343 | item.AssetID = m_asset.FullID; | 343 | // { |
344 | if (item.AssetID != UUID.Zero) | 344 | // We must always store the item at this point even if the asset hasn't finished uploading, in order |
345 | m_Scene.InventoryService.UpdateItem(item); | 345 | // to avoid a race condition when the appearance module retrieves the item to set the asset id in |
346 | // the AvatarAppearance structure. | ||
347 | // item.AssetID = m_asset.FullID; | ||
348 | // m_Scene.InventoryService.UpdateItem(item); | ||
349 | // } | ||
346 | 350 | ||
347 | if (m_uploadState == UploadState.Complete) | 351 | if (m_uploadState == UploadState.Complete) |
348 | { | 352 | { |
@@ -350,10 +354,21 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
350 | } | 354 | } |
351 | else | 355 | else |
352 | { | 356 | { |
353 | // m_log.DebugFormat( | 357 | // do it here to avoid the eventual race condition |
354 | // "[ASSET XFER UPLOADER]: Holding update inventory item request {0} for {1} pending completion of asset xfer for transaction {2}", | 358 | if (m_asset.FullID != UUID.Zero) |
355 | // item.Name, remoteClient.Name, transactionID); | 359 | { |
356 | 360 | // We must always store the item at this point even if the asset hasn't finished uploading, in order | |
361 | // to avoid a race condition when the appearance module retrieves the item to set the asset id in | ||
362 | // the AvatarAppearance structure. | ||
363 | item.AssetID = m_asset.FullID; | ||
364 | m_Scene.InventoryService.UpdateItem(item); | ||
365 | } | ||
366 | |||
367 | |||
368 | // m_log.DebugFormat( | ||
369 | // "[ASSET XFER UPLOADER]: Holding update inventory item request {0} for {1} pending completion of asset xfer for transaction {2}", | ||
370 | // item.Name, remoteClient.Name, transactionID); | ||
371 | |||
357 | m_updateItem = true; | 372 | m_updateItem = true; |
358 | m_updateItemData = item; | 373 | m_updateItemData = item; |
359 | } | 374 | } |
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs index f235446..243da52 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs | |||
@@ -474,7 +474,13 @@ namespace OpenSim.Services.Connectors | |||
474 | { "CreationDate", item.CreationDate.ToString() } | 474 | { "CreationDate", item.CreationDate.ToString() } |
475 | }); | 475 | }); |
476 | 476 | ||
477 | return CheckReturn(ret); | 477 | bool result = CheckReturn(ret); |
478 | if (result) | ||
479 | { | ||
480 | m_ItemCache.AddOrUpdate(item.ID, item, CACHE_EXPIRATION_SECONDS); | ||
481 | } | ||
482 | |||
483 | return result; | ||
478 | } | 484 | } |
479 | 485 | ||
480 | public bool MoveItems(UUID principalID, List<InventoryItemBase> items) | 486 | public bool MoveItems(UUID principalID, List<InventoryItemBase> items) |
@@ -551,6 +557,7 @@ namespace OpenSim.Services.Connectors | |||
551 | List<UUID> pending = new List<UUID>(); | 557 | List<UUID> pending = new List<UUID>(); |
552 | InventoryItemBase item = null; | 558 | InventoryItemBase item = null; |
553 | int i = 0; | 559 | int i = 0; |
560 | |||
554 | foreach (UUID id in itemIDs) | 561 | foreach (UUID id in itemIDs) |
555 | { | 562 | { |
556 | if (m_ItemCache.TryGetValue(id, out item)) | 563 | if (m_ItemCache.TryGetValue(id, out item)) |