From 0855066968e30a9965088c14234b2bc93daf0481 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Sat, 8 Dec 2007 14:27:12 +0000 Subject: This patch fixes mantis 105. Basically, it stops the index exception when no root folder is found and it makes the user server wait longer for the inventory server to do its work. From Justin Casey (IBM) --- OpenSim/Grid/UserServer/UserLoginService.cs | 34 +++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'OpenSim/Grid') diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index f404cce..fa5eac5 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs @@ -197,15 +197,32 @@ namespace OpenSim.Grid.UserServer protected override InventoryData CreateInventoryData(LLUUID userID) { - List folders = SynchronousRestObjectPoster.BeginPostObject>("POST", m_config.InventoryUrl + "RootFolders/", userID); - if (folders ==null | folders.Count == 0) + List folders + = SynchronousRestObjectPoster.BeginPostObject>( + "POST", m_config.InventoryUrl + "RootFolders/", userID); + + // In theory, the user will only ever be missing a root folder in situations where a grid + // which didn't previously run a grid wide inventory server is being transitioned to one + // which does. + if (null == folders | folders.Count == 0) { - RestObjectPoster.BeginPostObject(m_config.InventoryUrl + "CreateInventory/", userID); - Thread.Sleep(1000); - folders = SynchronousRestObjectPoster.BeginPostObject>("POST", m_config.InventoryUrl + "RootFolders/", userID); + MainLog.Instance.Warn( + "LOGIN", + "A root inventory folder for user ID " + userID + " was not found. A new set" + + " of empty inventory folders is being created."); + + RestObjectPoster.BeginPostObject( + m_config.InventoryUrl + "CreateInventory/", userID); + + // 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); + folders = SynchronousRestObjectPoster.BeginPostObject>( + "POST", m_config.InventoryUrl + "RootFolders/", userID); } - if(folders.Count >0) + if (folders.Count > 0) { LLUUID rootID = LLUUID.Zero; ArrayList AgentInventoryArray = new ArrayList(); @@ -228,6 +245,9 @@ namespace OpenSim.Grid.UserServer } else { + MainLog.Instance.Warn("LOGIN", "The root inventory folder could still not be retrieved" + + " for user ID " + userID); + AgentInventory userInventory = new AgentInventory(); userInventory.CreateRootFolder(userID, false); @@ -248,4 +268,4 @@ namespace OpenSim.Grid.UserServer } } } -} \ No newline at end of file +} -- cgit v1.1