Move the inventory request lock introduced in git master a58152bd to HGInventoryBroker to preserve that behaviour there but allow 2 simultaneous inv requests (chiefly WebFetch) rather than 1

This lock serialized all requests and made the inventory throttling in WebFetch redundant.
By moving this lock, two simultaneous requests may now take place which may help with http://opensimulator.org/mantis/view.php?id=7054
bullet-2.82
Justin Clark-Casey (justincc) 2014-08-09 00:52:51 +01:00
parent 30f1b424bb
commit 8738445eb7
2 changed files with 47 additions and 27 deletions

View File

@ -62,6 +62,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
private InventoryCache m_Cache = new InventoryCache();
/// <summary>
/// Used to serialize inventory requests.
/// </summary>
private object m_Lock = new object();
protected IUserManagement m_UserManagement;
protected IUserManagement UserManagementModule
{
@ -301,6 +306,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
public bool CreateUserInventory(UUID userID)
{
lock (m_Lock)
return m_LocalGridInventoryService.CreateUserInventory(userID);
}
@ -309,6 +315,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(userID);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.GetInventorySkeleton(userID);
IInventoryService connector = GetConnector(invURL);
@ -326,6 +333,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(userID);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.GetRootFolder(userID);
IInventoryService connector = GetConnector(invURL);
@ -347,6 +355,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(userID);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.GetFolderForType(userID, type);
IInventoryService connector = GetConnector(invURL);
@ -365,6 +374,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(userID);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.GetFolderContent(userID, folderID);
InventoryCollection c = m_Cache.GetFolderContent(userID, folderID);
@ -375,8 +385,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
}
IInventoryService connector = GetConnector(invURL);
return connector.GetFolderContent(userID, folderID);
return connector.GetFolderContent(userID, folderID);
}
public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
@ -386,6 +396,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(userID);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.GetFolderItems(userID, folderID);
List<InventoryItemBase> items = m_Cache.GetFolderItems(userID, folderID);
@ -396,8 +407,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
}
IInventoryService connector = GetConnector(invURL);
return connector.GetFolderItems(userID, folderID);
return connector.GetFolderItems(userID, folderID);
}
public bool AddFolder(InventoryFolderBase folder)
@ -410,6 +421,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(folder.Owner);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.AddFolder(folder);
IInventoryService connector = GetConnector(invURL);
@ -427,6 +439,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(folder.Owner);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.UpdateFolder(folder);
IInventoryService connector = GetConnector(invURL);
@ -446,6 +459,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(ownerID);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.DeleteFolders(ownerID, folderIDs);
IInventoryService connector = GetConnector(invURL);
@ -463,6 +477,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(folder.Owner);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.MoveFolder(folder);
IInventoryService connector = GetConnector(invURL);
@ -480,6 +495,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(folder.Owner);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.PurgeFolder(folder);
IInventoryService connector = GetConnector(invURL);
@ -497,6 +513,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(item.Owner);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.AddItem(item);
IInventoryService connector = GetConnector(invURL);
@ -514,6 +531,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(item.Owner);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.UpdateItem(item);
IInventoryService connector = GetConnector(invURL);
@ -533,6 +551,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(ownerID);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.MoveItems(ownerID, items);
IInventoryService connector = GetConnector(invURL);
@ -552,6 +571,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(ownerID);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.DeleteItems(ownerID, itemIDs);
IInventoryService connector = GetConnector(invURL);
@ -568,6 +588,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(item.Owner);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.GetItem(item);
IInventoryService connector = GetConnector(invURL);
@ -585,6 +606,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(folder.Owner);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.GetFolder(folder);
IInventoryService connector = GetConnector(invURL);
@ -609,6 +631,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(userID);
if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock)
return m_LocalGridInventoryService.GetAssetPermissions(userID, assetID);
IInventoryService connector = GetConnector(invURL);

View File

@ -62,8 +62,6 @@ namespace OpenSim.Services.Connectors
/// </remarks>
private int m_requestTimeoutSecs = -1;
private object m_Lock = new object();
public XInventoryServicesConnector()
{
}
@ -533,10 +531,9 @@ namespace OpenSim.Services.Connectors
RequestsMade++;
string reply = string.Empty;
lock (m_Lock)
reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/xinventory",
string reply
= SynchronousRestFormsRequester.MakeRequest(
"POST", m_ServerURI + "/xinventory",
ServerUtils.BuildQueryString(sendData), m_requestTimeoutSecs, m_Auth);
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(