* Change lazy user inventory creation on first login to synchronous rather than async.

* Add more error checking so that we don't proceed if there has been a problem with inventory retrieval
0.6.0-stable
Justin Clarke Casey 2008-04-20 18:45:03 +00:00
parent d3cd2b0ae4
commit e755727a0f
2 changed files with 21 additions and 16 deletions

View File

@ -83,7 +83,7 @@ namespace OpenSim.Framework.Communications
InventoryFolderBase rootFolder = RequestRootFolder(userId); InventoryFolderBase rootFolder = RequestRootFolder(userId);
// Agent is completely new and has no inventory structure yet. // Agent has no inventory structure yet.
if (null == rootFolder) if (null == rootFolder)
{ {
return null; return null;

View File

@ -303,9 +303,8 @@ namespace OpenSim.Grid.UserServer
protected override InventoryData GetInventorySkeleton(LLUUID userID) protected override InventoryData GetInventorySkeleton(LLUUID userID)
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[LOGIN]: Contacting inventory service at {0} for inventory skeleton of agent {1}", "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}",
m_config.InventoryUrl, userID); m_config.InventoryUrl, userID);
List<InventoryFolderBase> folders List<InventoryFolderBase> folders
= SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
@ -316,22 +315,27 @@ namespace OpenSim.Grid.UserServer
// which does. // which does.
if (null == folders || folders.Count == 0) if (null == folders || folders.Count == 0)
{ {
m_log.Warn( m_log.InfoFormat(
"[LOGIN]: " + "[LOGIN]: A root inventory folder for user {0} was not found. Requesting creation.", userID);
"root inventory folder user " + userID + " not found. Creating.");
RestObjectPoster.BeginPostObject<Guid>( bool created =
m_config.InventoryUrl + "CreateInventory/", userID.UUID); SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
"POST", m_config.InventoryUrl + "CreateInventory/", userID.UUID);
// A big delay should be okay here since the recreation of the user's root folders should
// only ever happen once. We need to sleep to let the inventory server do its work - if (!created)
// previously 1000ms has been found to be too short. {
Thread.Sleep(10000); throw new Exception(
String.Format(
"The inventory creation request for user {0} did not succeed."
+ " Please contact your inventory service provider for more information.",
userID));
}
folders = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( folders = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
"POST", m_config.InventoryUrl + "RootFolders/", userID.UUID); "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID);
} }
if (folders.Count > 0) if (folders != null && folders.Count > 0)
{ {
LLUUID rootID = LLUUID.Zero; LLUUID rootID = LLUUID.Zero;
ArrayList AgentInventoryArray = new ArrayList(); ArrayList AgentInventoryArray = new ArrayList();
@ -358,7 +362,8 @@ namespace OpenSim.Grid.UserServer
{ {
throw new Exception( throw new Exception(
String.Format( String.Format(
"A root inventory folder for {0} could not be retrieved from the inventory service", userID)); "A root inventory folder for user {0} could not be retrieved from the inventory service",
userID));
} }
} }
} }