diff options
author | Diva Canto | 2015-06-02 15:40:13 -0700 |
---|---|---|
committer | Diva Canto | 2015-06-02 15:40:13 -0700 |
commit | be6fb22d69f4b2438c5a15cd21e90aaf5bc2f34c (patch) | |
tree | d21f3eb7897efb5531752283a553205862a59320 | |
parent | Mantis #7594: putting things as they were before regarding duplicate removal.... (diff) | |
download | opensim-SC-be6fb22d69f4b2438c5a15cd21e90aaf5bc2f34c.zip opensim-SC-be6fb22d69f4b2438c5a15cd21e90aaf5bc2f34c.tar.gz opensim-SC-be6fb22d69f4b2438c5a15cd21e90aaf5bc2f34c.tar.bz2 opensim-SC-be6fb22d69f4b2438c5a15cd21e90aaf5bc2f34c.tar.xz |
Mantis #7567. One of the reported log messages showed this:
09:38:40 - [LOGHTTP]: Slow handling of 15572 POST /CAPS/b12c7e98-8261-4953-b7d1-1c414c9893fc FetchInventory2 8acfbca3-13b5-434f-898c-5f4bbe8a76ff from 92.237.199.112:60083 took 62391ms
FetchInventory itself wasn't taking advantage of the new inventory API. This commit fixes that.
-rw-r--r-- | OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs index b67b326..0832b02 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.Reflection; | ||
28 | using OpenMetaverse; | 29 | using OpenMetaverse; |
29 | using OpenMetaverse.StructuredData; | 30 | using OpenMetaverse.StructuredData; |
30 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
@@ -34,11 +35,13 @@ using OpenSim.Services.Interfaces; | |||
34 | using OSDArray = OpenMetaverse.StructuredData.OSDArray; | 35 | using OSDArray = OpenMetaverse.StructuredData.OSDArray; |
35 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; | 36 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; |
36 | 37 | ||
38 | using log4net; | ||
39 | |||
37 | namespace OpenSim.Capabilities.Handlers | 40 | namespace OpenSim.Capabilities.Handlers |
38 | { | 41 | { |
39 | public class FetchInventory2Handler | 42 | public class FetchInventory2Handler |
40 | { | 43 | { |
41 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
42 | 45 | ||
43 | private IInventoryService m_inventoryService; | 46 | private IInventoryService m_inventoryService; |
44 | private UUID m_agentID; | 47 | private UUID m_agentID; |
@@ -59,12 +62,32 @@ namespace OpenSim.Capabilities.Handlers | |||
59 | string reply; | 62 | string reply; |
60 | LLSDFetchInventory llsdReply = new LLSDFetchInventory(); | 63 | LLSDFetchInventory llsdReply = new LLSDFetchInventory(); |
61 | 64 | ||
65 | UUID[] itemIDs = new UUID[itemsRequested.Count]; | ||
66 | int i = 0; | ||
62 | foreach (OSDMap osdItemId in itemsRequested) | 67 | foreach (OSDMap osdItemId in itemsRequested) |
63 | { | 68 | { |
64 | UUID itemId = osdItemId["item_id"].AsUUID(); | 69 | itemIDs[i++] = osdItemId["item_id"].AsUUID(); |
70 | } | ||
65 | 71 | ||
66 | InventoryItemBase item = m_inventoryService.GetItem(new InventoryItemBase(itemId, m_agentID)); | 72 | InventoryItemBase[] items = m_inventoryService.GetMultipleItems(m_agentID, itemIDs); |
73 | |||
74 | if (items == null) | ||
75 | { | ||
76 | // OMG!!! One by one!!! This is fallback code, in case the backend isn't updated | ||
77 | m_log.WarnFormat("[FETCH INVENTORY HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one."); | ||
78 | items = new InventoryItemBase[itemsRequested.Count]; | ||
79 | i = 0; | ||
80 | InventoryItemBase item = new InventoryItemBase(); | ||
81 | item.Owner = m_agentID; | ||
82 | foreach (UUID id in itemIDs) | ||
83 | { | ||
84 | item.ID = id; | ||
85 | items[i++] = m_inventoryService.GetItem(item); | ||
86 | } | ||
87 | } | ||
67 | 88 | ||
89 | foreach (InventoryItemBase item in items) | ||
90 | { | ||
68 | if (item != null) | 91 | if (item != null) |
69 | { | 92 | { |
70 | // We don't know the agent that this request belongs to so we'll use the agent id of the item | 93 | // We don't know the agent that this request belongs to so we'll use the agent id of the item |