Async purge so that the client thread doesn't wait.

arthursv
Diva Canto 2009-08-19 00:33:02 -07:00
parent 4818d11b9d
commit 4382f28efc
2 changed files with 27 additions and 7 deletions

View File

@ -323,14 +323,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
private UUID GetSessionID(UUID userID) private UUID GetSessionID(UUID userID)
{ {
if (m_Scene == null) //if (m_Scene == null)
{ //{
m_log.Debug("[INVENTORY CONNECTOR]: OOPS! scene is null"); // m_log.Debug("[INVENTORY CONNECTOR]: OOPS! scene is null");
} //}
if (m_UserProfileService == null) if (m_UserProfileService == null)
{ {
m_log.Debug("[INVENTORY CONNECTOR]: OOPS! UserProfileCacheService is null"); //m_log.Debug("[INVENTORY CONNECTOR]: OOPS! UserProfileCacheService is null");
return UUID.Zero; return UUID.Zero;
} }

View File

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
using OpenMetaverse; using OpenMetaverse;
@ -558,15 +559,34 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
/// <param name="folderID"></param> /// <param name="folderID"></param>
delegate void PurgeFolderDelegate(UUID userID, UUID folder);
public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID) public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID)
{ {
InventoryFolderBase folder = new InventoryFolderBase(folderID, remoteClient.AgentId); PurgeFolderDelegate d = PurgeFolderAsync;
try
{
d.BeginInvoke(remoteClient.AgentId, folderID, PurgeFolderCompleted, d);
}
catch (Exception e)
{
m_log.WarnFormat("[AGENT INVENTORY]: Exception on purge folder for user {0}: {1}", remoteClient.AgentId, e.Message);
}
}
private void PurgeFolderAsync(UUID userID, UUID folderID)
{
InventoryFolderBase folder = new InventoryFolderBase(folderID, userID);
if (InventoryService.PurgeFolder(folder)) if (InventoryService.PurgeFolder(folder))
m_log.DebugFormat("[AGENT INVENTORY]: folder {0} purged successfully", folderID); m_log.DebugFormat("[AGENT INVENTORY]: folder {0} purged successfully", folderID);
else else
m_log.WarnFormat("[AGENT INVENTORY]: could not purge folder {0}", folderID); m_log.WarnFormat("[AGENT INVENTORY]: could not purge folder {0}", folderID);
} }
private void PurgeFolderCompleted(IAsyncResult iar)
{
}
} }
} }