* Added a lock to the user profile cache to prevent simultaneous duplicate additions to the database. (Attempting to fix bug reported by nebadon)
parent
7f2ec02802
commit
4dc8e7e0f8
|
@ -59,18 +59,22 @@ namespace OpenSim.Framework.Communications.Caches
|
||||||
/// <param name="userID"></param>
|
/// <param name="userID"></param>
|
||||||
public void AddNewUser(LLUUID userID)
|
public void AddNewUser(LLUUID userID)
|
||||||
{
|
{
|
||||||
if (!this.UserProfiles.ContainsKey(userID))
|
// Potential fix - Multithreading issue.
|
||||||
|
lock (UserProfiles)
|
||||||
{
|
{
|
||||||
CachedUserInfo userInfo = new CachedUserInfo(this.m_parent);
|
if (!this.UserProfiles.ContainsKey(userID))
|
||||||
userInfo.UserProfile = this.RequestUserProfileForUser(userID);
|
|
||||||
if (userInfo.UserProfile != null)
|
|
||||||
{
|
{
|
||||||
this.RequestInventoryForUser(userID, userInfo);
|
CachedUserInfo userInfo = new CachedUserInfo(this.m_parent);
|
||||||
this.UserProfiles.Add(userID, userInfo);
|
userInfo.UserProfile = this.RequestUserProfileForUser(userID);
|
||||||
}
|
if (userInfo.UserProfile != null)
|
||||||
else
|
{
|
||||||
{
|
this.RequestInventoryForUser(userID, userInfo);
|
||||||
System.Console.WriteLine("CACHE", "User profile for user not found");
|
this.UserProfiles.Add(userID, userInfo);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Console.WriteLine("CACHE", "User profile for user not found");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue