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,7 +306,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
public bool CreateUserInventory(UUID userID)
{
return m_LocalGridInventoryService.CreateUserInventory(userID);
lock (m_Lock)
return m_LocalGridInventoryService.CreateUserInventory(userID);
}
public List<InventoryFolderBase> GetInventorySkeleton(UUID userID)
@ -309,7 +315,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(userID);
if (invURL == null) // not there, forward to local inventory connector to resolve
return m_LocalGridInventoryService.GetInventorySkeleton(userID);
lock (m_Lock)
return m_LocalGridInventoryService.GetInventorySkeleton(userID);
IInventoryService connector = GetConnector(invURL);
@ -326,7 +333,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(userID);
if (invURL == null) // not there, forward to local inventory connector to resolve
return m_LocalGridInventoryService.GetRootFolder(userID);
lock (m_Lock)
return m_LocalGridInventoryService.GetRootFolder(userID);
IInventoryService connector = GetConnector(invURL);
@ -347,7 +355,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(userID);
if (invURL == null) // not there, forward to local inventory connector to resolve
return m_LocalGridInventoryService.GetFolderForType(userID, type);
lock (m_Lock)
return m_LocalGridInventoryService.GetFolderForType(userID, type);
IInventoryService connector = GetConnector(invURL);
@ -365,7 +374,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(userID);
if (invURL == null) // not there, forward to local inventory connector to resolve
return m_LocalGridInventoryService.GetFolderContent(userID, folderID);
lock (m_Lock)
return m_LocalGridInventoryService.GetFolderContent(userID, folderID);
InventoryCollection c = m_Cache.GetFolderContent(userID, folderID);
if (c != null)
@ -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,7 +396,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(userID);
if (invURL == null) // not there, forward to local inventory connector to resolve
return m_LocalGridInventoryService.GetFolderItems(userID, folderID);
lock (m_Lock)
return m_LocalGridInventoryService.GetFolderItems(userID, folderID);
List<InventoryItemBase> items = m_Cache.GetFolderItems(userID, folderID);
if (items != null)
@ -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,7 +421,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(folder.Owner);
if (invURL == null) // not there, forward to local inventory connector to resolve
return m_LocalGridInventoryService.AddFolder(folder);
lock (m_Lock)
return m_LocalGridInventoryService.AddFolder(folder);
IInventoryService connector = GetConnector(invURL);
@ -427,7 +439,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(folder.Owner);
if (invURL == null) // not there, forward to local inventory connector to resolve
return m_LocalGridInventoryService.UpdateFolder(folder);
lock (m_Lock)
return m_LocalGridInventoryService.UpdateFolder(folder);
IInventoryService connector = GetConnector(invURL);
@ -446,7 +459,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(ownerID);
if (invURL == null) // not there, forward to local inventory connector to resolve
return m_LocalGridInventoryService.DeleteFolders(ownerID, folderIDs);
lock (m_Lock)
return m_LocalGridInventoryService.DeleteFolders(ownerID, folderIDs);
IInventoryService connector = GetConnector(invURL);
@ -463,7 +477,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(folder.Owner);
if (invURL == null) // not there, forward to local inventory connector to resolve
return m_LocalGridInventoryService.MoveFolder(folder);
lock (m_Lock)
return m_LocalGridInventoryService.MoveFolder(folder);
IInventoryService connector = GetConnector(invURL);
@ -480,7 +495,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(folder.Owner);
if (invURL == null) // not there, forward to local inventory connector to resolve
return m_LocalGridInventoryService.PurgeFolder(folder);
lock (m_Lock)
return m_LocalGridInventoryService.PurgeFolder(folder);
IInventoryService connector = GetConnector(invURL);
@ -497,7 +513,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(item.Owner);
if (invURL == null) // not there, forward to local inventory connector to resolve
return m_LocalGridInventoryService.AddItem(item);
lock (m_Lock)
return m_LocalGridInventoryService.AddItem(item);
IInventoryService connector = GetConnector(invURL);
@ -514,7 +531,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(item.Owner);
if (invURL == null) // not there, forward to local inventory connector to resolve
return m_LocalGridInventoryService.UpdateItem(item);
lock (m_Lock)
return m_LocalGridInventoryService.UpdateItem(item);
IInventoryService connector = GetConnector(invURL);
@ -533,7 +551,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(ownerID);
if (invURL == null) // not there, forward to local inventory connector to resolve
return m_LocalGridInventoryService.MoveItems(ownerID, items);
lock (m_Lock)
return m_LocalGridInventoryService.MoveItems(ownerID, items);
IInventoryService connector = GetConnector(invURL);
@ -552,7 +571,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(ownerID);
if (invURL == null) // not there, forward to local inventory connector to resolve
return m_LocalGridInventoryService.DeleteItems(ownerID, itemIDs);
lock (m_Lock)
return m_LocalGridInventoryService.DeleteItems(ownerID, itemIDs);
IInventoryService connector = GetConnector(invURL);
@ -568,7 +588,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(item.Owner);
if (invURL == null) // not there, forward to local inventory connector to resolve
return m_LocalGridInventoryService.GetItem(item);
lock (m_Lock)
return m_LocalGridInventoryService.GetItem(item);
IInventoryService connector = GetConnector(invURL);
@ -585,7 +606,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(folder.Owner);
if (invURL == null) // not there, forward to local inventory connector to resolve
return m_LocalGridInventoryService.GetFolder(folder);
lock (m_Lock)
return m_LocalGridInventoryService.GetFolder(folder);
IInventoryService connector = GetConnector(invURL);
@ -609,7 +631,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
string invURL = GetInventoryServiceURL(userID);
if (invURL == null) // not there, forward to local inventory connector to resolve
return m_LocalGridInventoryService.GetAssetPermissions(userID, assetID);
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,11 +531,10 @@ namespace OpenSim.Services.Connectors
RequestsMade++;
string reply = string.Empty;
lock (m_Lock)
reply = SynchronousRestFormsRequester.MakeRequest("POST",
m_ServerURI + "/xinventory",
ServerUtils.BuildQueryString(sendData), m_requestTimeoutSecs, m_Auth);
string reply
= SynchronousRestFormsRequester.MakeRequest(
"POST", m_ServerURI + "/xinventory",
ServerUtils.BuildQueryString(sendData), m_requestTimeoutSecs, m_Auth);
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
reply);