From 50e3eb31b0c2479e0fa7511aff879426b893a35d Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Tue, 11 Nov 2008 17:54:21 +0000
Subject: * Restore storing null to represent 'missing asset' requests in the
AssetCache * If we don't do this then callers to the polling GetAsset wait
the full polling time before returning
---
OpenSim/Framework/Communications/Cache/AssetCache.cs | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index fe25eca..9945829 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -245,15 +245,13 @@ namespace OpenSim.Framework.Communications.Cache
///
/// Synchronously retreive an asset. If the asset isn't in the cache, a request will be made to the persistent store to
/// load it into the cache.
+ ///
///
/// XXX We'll keep polling the cache until we get the asset or we exceed
/// the allowed number of polls. This isn't a very good way of doing things since a single thread
/// is processing inbound packets, so if the asset server is slow, we could block this for up to
- /// the timeout period. What we might want to do is register asynchronous callbacks on asset
- /// receipt in the same manner as the TextureDownloadModule. Of course,
- /// a timeout before asset receipt usually isn't fatal, the operation will work on the retry when the
- /// asset is much more likely to have made it into the cache.
- ///
+ /// the timeout period. Whereever possible we want to use the asynchronous callback GetAsset()
+ ///
///
///
/// null if the asset could not be retrieved
@@ -270,6 +268,7 @@ namespace OpenSim.Framework.Communications.Cache
{
return asset;
}
+
m_assetServer.RequestAsset(assetID, isTexture);
do
@@ -280,7 +279,8 @@ namespace OpenSim.Framework.Communications.Cache
{
return asset;
}
- } while (--maxPolls > 0);
+ }
+ while (--maxPolls > 0);
m_log.WarnFormat("[ASSET CACHE]: {0} {1} was not received before the retrieval timeout was reached",
isTexture ? "texture" : "asset", assetID.ToString());
@@ -400,6 +400,9 @@ namespace OpenSim.Framework.Communications.Cache
{
// m_log.WarnFormat("[ASSET CACHE]: AssetNotFound for {0}", assetID);
+ // Remember the fact that this asset could not be found to prevent delays from repeated requests
+ m_memcache.Add(assetID, null, TimeSpan.FromHours(24));
+
// Notify requesters for this asset
AssetRequestsList reqList;
lock (RequestLists)
--
cgit v1.1