Added a Sleep in between each site call, to slow the xml-rpc requests down.

bulletsim
Diva Canto 2011-06-10 21:17:34 -07:00
parent 5f311c91c7
commit e07d71d298
1 changed files with 40 additions and 37 deletions

View File

@ -29,6 +29,8 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Threading;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using Nwc.XmlRpc; using Nwc.XmlRpc;
@ -194,46 +196,46 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
//} //}
private void CollectOnlineFriendsElsewhere(UUID userID, List<string> foreignFriends) //private void CollectOnlineFriendsElsewhere(UUID userID, List<string> foreignFriends)
{ //{
// let's divide the friends on a per-domain basis // // let's divide the friends on a per-domain basis
Dictionary<string, List<string>> friendsPerDomain = new Dictionary<string, List<string>>(); // Dictionary<string, List<string>> friendsPerDomain = new Dictionary<string, List<string>>();
foreach (string friend in foreignFriends) // foreach (string friend in foreignFriends)
{ // {
UUID friendID; // UUID friendID;
if (!UUID.TryParse(friend, out friendID)) // if (!UUID.TryParse(friend, out friendID))
{ // {
// it's a foreign friend // // it's a foreign friend
string url = string.Empty, tmp = string.Empty; // string url = string.Empty, tmp = string.Empty;
if (Util.ParseUniversalUserIdentifier(friend, out friendID, out url, out tmp, out tmp, out tmp)) // if (Util.ParseUniversalUserIdentifier(friend, out friendID, out url, out tmp, out tmp, out tmp))
{ // {
if (!friendsPerDomain.ContainsKey(url)) // if (!friendsPerDomain.ContainsKey(url))
friendsPerDomain[url] = new List<string>(); // friendsPerDomain[url] = new List<string>();
friendsPerDomain[url].Add(friend); // friendsPerDomain[url].Add(friend);
} // }
} // }
} // }
// Now, call those worlds // // Now, call those worlds
foreach (KeyValuePair<string, List<string>> kvp in friendsPerDomain) // foreach (KeyValuePair<string, List<string>> kvp in friendsPerDomain)
{ // {
List<string> ids = new List<string>(); // List<string> ids = new List<string>();
foreach (string f in kvp.Value) // foreach (string f in kvp.Value)
ids.Add(f); // ids.Add(f);
UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key); // UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key);
List<UUID> online = uConn.GetOnlineFriends(userID, ids); // List<UUID> online = uConn.GetOnlineFriends(userID, ids);
// Finally send the notifications to the user // // Finally send the notifications to the user
// this whole process may take a while, so let's check at every // // this whole process may take a while, so let's check at every
// iteration that the user is still here // // iteration that the user is still here
IClientAPI client = LocateClientObject(userID); // IClientAPI client = LocateClientObject(userID);
if (client != null) // if (client != null)
client.SendAgentOnline(online.ToArray()); // client.SendAgentOnline(online.ToArray());
else // else
break; // break;
} // }
} //}
protected override void StatusNotify(List<FriendInfo> friendList, UUID userID, bool online) protected override void StatusNotify(List<FriendInfo> friendList, UUID userID, bool online)
{ {
@ -280,6 +282,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
ids.Add(f.Friend); ids.Add(f.Friend);
UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key, false); UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key, false);
List<UUID> friendsOnline = uConn.StatusNotification(ids, userID, online); List<UUID> friendsOnline = uConn.StatusNotification(ids, userID, online);
Thread.Sleep(100);
// need to debug this here // need to debug this here
if (online) if (online)
{ {