From 451a5bbf30bf0ff02c7318b7b6f9f708309165ac Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Sun, 13 Apr 2008 22:09:07 +0000 Subject: [PATCH] * Put in crude poll waiting for 60 seconds for delayed user inventory delivery from the inventory service * This will reduce failures where the inventory server is simply slow * Still need to properly inform the user if the inventory service has failed altogether --- .../Cache/UserProfileCacheService.cs | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index 6b09e01e04..7995841338 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs @@ -355,11 +355,36 @@ namespace OpenSim.Framework.Communications.Cache if ((fold = libraryRoot.HasSubFolder(folderID)) != null) { return fold.RequestListOfItems(); - } + } CachedUserInfo userProfile; if (m_userProfiles.TryGetValue(agentID, out userProfile)) - { + { + // XXX: When a client crosses into a scene, their entire inventory is fetched + // asynchronously. If the client makes a request before the inventory is received, we need + // to give the inventory a chance to come in. + // + // This is a crude way of dealing with that by retrying the lookup. It's not quite as bad + // in CAPS as doing this with the udp request, since here it won't hold up other packets. + // In fact, here we'll be generous and try for longer. + if (!userProfile.HasInventory) + { + int attempts = 0; + while (attempts++ < 20) + { + m_log.DebugFormat( + "[INVENTORY CACHE]: Poll number {0} for inventory items in folder {1} for user {2}", + attempts, folderID, agentID); + + Thread.Sleep(3000); + + if (userProfile.HasInventory) + { + break; + } + } + } + if (userProfile.HasInventory) { if (userProfile.RootFolder.ID == folderID)