From 5a6bc26600c80d8e838bafdde4df970841c6c285 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 9 Mar 2009 17:55:08 +0000 Subject: * Address http://opensimulator.org/mantis/view.php?id=3207 * A saved archive now immediately expires the data in the asset cache that it used, rather than retaining all the assets (esp textures) in the cache. * This is an imperfect solution. Ideally we would only expire the assets newly requested for the archive (not existing ones). But doing that would require a lot more restructuring. * I don't believe there are any locking issues due to the locking performed by the underlying memory cache, but please report any issues. --- OpenSim/Framework/Communications/Cache/AssetCache.cs | 5 +---- OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | 10 ++++++++-- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 800c997..30f7ddf 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs @@ -46,8 +46,7 @@ namespace OpenSim.Framework.Communications.Cache /// This class actually encapsulates two largely separate mechanisms. One mechanism fetches assets either /// synchronously or async and passes the data back to the requester. The second mechanism fetches assets and /// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and - /// AssetNotFound(), which means they do share the same asset and texture caches.I agr - + /// AssetNotFound(), which means they do share the same asset and texture caches. public class AssetCache : IAssetCache { @@ -401,9 +400,7 @@ namespace OpenSim.Framework.Communications.Cache m_memcache.AddOrUpdate(assetInf.FullID, assetInf, TimeSpan.FromHours(24)); if (StatsManager.SimExtraStats != null) - { StatsManager.SimExtraStats.AddAsset(assetInf); - } if (RequestedAssets.ContainsKey(assetInf.FullID)) { diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index 99ec9b4..076fbce 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs @@ -72,7 +72,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// protected IAssetCache m_assetCache; - protected internal AssetsRequest(ICollection uuids, IAssetCache assetCache, AssetsRequestCallback assetsRequestCallback) + protected internal AssetsRequest( + ICollection uuids, IAssetCache assetCache, AssetsRequestCallback assetsRequestCallback) { m_uuids = uuids; m_assetsRequestCallback = assetsRequestCallback; @@ -100,9 +101,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver public void AssetRequestCallback(UUID assetID, AssetBase asset) { if (asset != null) - m_assets[assetID] = asset; + { + m_assetCache.ExpireAsset(assetID); + m_assets[assetID] = asset; + } else + { m_notFoundAssetUuids.Add(assetID); + } //m_log.DebugFormat( // "[ARCHIVER]: Received {0} assets and notification of {1} missing assets", m_assets.Count, m_notFoundAssetUuids.Count); -- cgit v1.1