From e755727a0ff4af37f5cbd074800a15144707b4a7 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Sun, 20 Apr 2008 18:45:03 +0000 Subject: [PATCH] * 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 --- .../Communications/InventoryServiceBase.cs | 2 +- OpenSim/Grid/UserServer/UserLoginService.cs | 35 +++++++++++-------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index aedf4b3c5d..d4e75391c9 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs @@ -83,7 +83,7 @@ namespace OpenSim.Framework.Communications InventoryFolderBase rootFolder = RequestRootFolder(userId); - // Agent is completely new and has no inventory structure yet. + // Agent has no inventory structure yet. if (null == rootFolder) { return null; diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index a3bc9f013a..e71a2ccaf4 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs @@ -303,9 +303,8 @@ namespace OpenSim.Grid.UserServer protected override InventoryData GetInventorySkeleton(LLUUID userID) { m_log.DebugFormat( - "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of agent {1}", - m_config.InventoryUrl, userID); - + "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}", + m_config.InventoryUrl, userID); List folders = SynchronousRestObjectPoster.BeginPostObject>( @@ -316,22 +315,27 @@ namespace OpenSim.Grid.UserServer // which does. if (null == folders || folders.Count == 0) { - m_log.Warn( - "[LOGIN]: " + - "root inventory folder user " + userID + " not found. Creating."); + m_log.InfoFormat( + "[LOGIN]: A root inventory folder for user {0} was not found. Requesting creation.", userID); - RestObjectPoster.BeginPostObject( - 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 - - // previously 1000ms has been found to be too short. - Thread.Sleep(10000); + bool created = + SynchronousRestObjectPoster.BeginPostObject( + "POST", m_config.InventoryUrl + "CreateInventory/", userID.UUID); + + if (!created) + { + 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>( "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID); } - if (folders.Count > 0) + if (folders != null && folders.Count > 0) { LLUUID rootID = LLUUID.Zero; ArrayList AgentInventoryArray = new ArrayList(); @@ -358,7 +362,8 @@ namespace OpenSim.Grid.UserServer { throw new Exception( 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)); } } }