* Cache null account responses in the SimianUserAccountServiceConnector to avoid repeated requests for missing avatar IDs

* Updated to OpenMetaverse r3442 to fix a timezone issue with ExpiringCache
viewer-2-initial-appearance
John Hurliman 2010-09-07 14:41:13 -07:00
parent 587bab79b4
commit 9be1c0ff44
11 changed files with 34 additions and 19 deletions

View File

@ -46,7 +46,7 @@ namespace OpenSim.Framework
case AssetType.Texture: case AssetType.Texture:
return "image/x-j2c"; return "image/x-j2c";
case AssetType.Sound: case AssetType.Sound:
return "application/ogg"; return "audio/ogg";
case AssetType.CallingCard: case AssetType.CallingCard:
return "application/vnd.ll.callingcard"; return "application/vnd.ll.callingcard";
case AssetType.Landmark: case AssetType.Landmark:
@ -98,8 +98,6 @@ namespace OpenSim.Framework
return "application/vnd.ll.outfitfolder"; return "application/vnd.ll.outfitfolder";
case AssetType.MyOutfitsFolder: case AssetType.MyOutfitsFolder:
return "application/vnd.ll.myoutfitsfolder"; return "application/vnd.ll.myoutfitsfolder";
case AssetType.InboxFolder:
return "application/vnd.ll.inboxfolder";
case AssetType.Unknown: case AssetType.Unknown:
default: default:
return "application/octet-stream"; return "application/octet-stream";
@ -128,7 +126,7 @@ namespace OpenSim.Framework
case InventoryType.Object: case InventoryType.Object:
return "application/vnd.ll.primitive"; return "application/vnd.ll.primitive";
case InventoryType.Sound: case InventoryType.Sound:
return "application/ogg"; return "audio/ogg";
case InventoryType.Snapshot: case InventoryType.Snapshot:
case InventoryType.Texture: case InventoryType.Texture:
return "image/x-j2c"; return "image/x-j2c";
@ -147,6 +145,7 @@ namespace OpenSim.Framework
case "image/jp2": case "image/jp2":
return (sbyte)AssetType.Texture; return (sbyte)AssetType.Texture;
case "application/ogg": case "application/ogg":
case "audio/ogg":
return (sbyte)AssetType.Sound; return (sbyte)AssetType.Sound;
case "application/vnd.ll.callingcard": case "application/vnd.ll.callingcard":
case "application/x-metaverse-callingcard": case "application/x-metaverse-callingcard":
@ -209,8 +208,6 @@ namespace OpenSim.Framework
return (sbyte)AssetType.OutfitFolder; return (sbyte)AssetType.OutfitFolder;
case "application/vnd.ll.myoutfitsfolder": case "application/vnd.ll.myoutfitsfolder":
return (sbyte)AssetType.MyOutfitsFolder; return (sbyte)AssetType.MyOutfitsFolder;
case "application/vnd.ll.inboxfolder":
return (sbyte)AssetType.InboxFolder;
case "application/octet-stream": case "application/octet-stream":
default: default:
return (sbyte)AssetType.Unknown; return (sbyte)AssetType.Unknown;
@ -227,6 +224,7 @@ namespace OpenSim.Framework
case "image/jpeg": case "image/jpeg":
return (sbyte)InventoryType.Texture; return (sbyte)InventoryType.Texture;
case "application/ogg": case "application/ogg":
case "audio/ogg":
case "audio/x-wav": case "audio/x-wav":
return (sbyte)InventoryType.Sound; return (sbyte)InventoryType.Sound;
case "application/vnd.ll.callingcard": case "application/vnd.ll.callingcard":

View File

@ -3529,9 +3529,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private void ProcessEntityUpdates(int maxUpdates) private void ProcessEntityUpdates(int maxUpdates)
{ {
Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); OpenMetaverse.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenMetaverse.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>(); OpenMetaverse.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenMetaverse.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>();
Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); OpenMetaverse.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenMetaverse.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
if (maxUpdates <= 0) maxUpdates = Int32.MaxValue; if (maxUpdates <= 0) maxUpdates = Int32.MaxValue;
int updatesThisCall = 0; int updatesThisCall = 0;

View File

@ -140,13 +140,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
// Process all the pending adds // Process all the pending adds
OutgoingPacket pendingAdd; OutgoingPacket pendingAdd;
while (m_pendingAdds.Dequeue(out pendingAdd)) while (m_pendingAdds.TryDequeue(out pendingAdd))
m_packets[pendingAdd.SequenceNumber] = pendingAdd; m_packets[pendingAdd.SequenceNumber] = pendingAdd;
// Process all the pending removes, including updating statistics and round-trip times // Process all the pending removes, including updating statistics and round-trip times
PendingAck pendingRemove; PendingAck pendingRemove;
OutgoingPacket ackedPacket; OutgoingPacket ackedPacket;
while (m_pendingRemoves.Dequeue(out pendingRemove)) while (m_pendingRemoves.TryDequeue(out pendingRemove))
{ {
if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket))
{ {

View File

@ -252,7 +252,7 @@ namespace Flotsam.RegionModules.AssetCache
} }
else else
{ {
m_MemoryCache.AddOrUpdate(key, asset, DateTime.MaxValue); m_MemoryCache.AddOrUpdate(key, asset, Double.MaxValue);
} }
} }
} }

View File

@ -36,6 +36,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
{ {
public class UserAccountCache public class UserAccountCache
{ {
private const double CACHE_EXPIRATION_SECONDS = 120.0;
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
@ -51,9 +53,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
public void Cache(UUID userID, UserAccount account) public void Cache(UUID userID, UserAccount account)
{ {
// Cache even null accounts // Cache even null accounts
m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS);
if (account != null) if (account != null)
m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromMinutes(2.0d)); m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS);
m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); m_log.DebugFormat("[USER CACHE]: cached user {0}", userID);
} }

View File

@ -48,6 +48,7 @@ using OpenSim.Tests.Common.Setup;
using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants;
using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader; using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader;
using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter; using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter;
using RegionSettings = OpenSim.Framework.RegionSettings;
namespace OpenSim.Region.CoreModules.World.Archiver.Tests namespace OpenSim.Region.CoreModules.World.Archiver.Tests
{ {
@ -135,7 +136,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
SceneObjectPart part2 = CreateSceneObjectPart2(); SceneObjectPart part2 = CreateSceneObjectPart2();
AssetNotecard nc = new AssetNotecard("Hello World!"); AssetNotecard nc = new AssetNotecard();
nc.BodyText = "Hello World!";
nc.Encode();
UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
AssetBase ncAsset AssetBase ncAsset

View File

@ -75,7 +75,9 @@ namespace OpenSim.Region.Framework.Tests
protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part) protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part)
{ {
AssetNotecard nc = new AssetNotecard("Hello World!"); AssetNotecard nc = new AssetNotecard();
nc.BodyText = "Hello World!";
nc.Encode();
UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
AssetBase ncAsset AssetBase ncAsset

View File

@ -49,6 +49,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule
{ {
private const double CACHE_EXPIRATION_SECONDS = 120.0;
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
@ -141,7 +143,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
{ "UserID", userID.ToString() } { "UserID", userID.ToString() }
}; };
return GetUser(requestArgs); account = GetUser(requestArgs);
if (account == null)
{
// Store null responses too, to avoid repeated lookups for missing accounts
m_accountCache.AddOrUpdate(userID, null, CACHE_EXPIRATION_SECONDS);
}
return account;
} }
public List<UserAccount> GetUserAccounts(UUID scopeID, string query) public List<UserAccount> GetUserAccounts(UUID scopeID, string query)
@ -216,7 +226,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
if (success) if (success)
{ {
// Cache the user account info // Cache the user account info
m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromMinutes(2.0d)); m_accountCache.AddOrUpdate(data.PrincipalID, data, CACHE_EXPIRATION_SECONDS);
} }
else else
{ {
@ -281,7 +291,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName);
// Cache the user account info // Cache the user account info
m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); m_accountCache.AddOrUpdate(account.PrincipalID, account, CACHE_EXPIRATION_SECONDS);
return account; return account;
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.