diff --git a/apps/openmw/mwworld/cellpreloader.cpp b/apps/openmw/mwworld/cellpreloader.cpp index 9f613ac80..7524fefd8 100644 --- a/apps/openmw/mwworld/cellpreloader.cpp +++ b/apps/openmw/mwworld/cellpreloader.cpp @@ -179,6 +179,7 @@ namespace MWWorld , mMinCacheSize(0) , mMaxCacheSize(0) , mPreloadInstances(true) + , mLastResourceCacheUpdate(0.0) { } @@ -252,8 +253,12 @@ namespace MWWorld ++it; } - // the resource cache is cleared from the worker thread so that we're not holding up the main thread with delete operations - mWorkQueue->addWorkItem(new UpdateCacheItem(mResourceSystem, mTerrain, timestamp), true); + if (timestamp - mLastResourceCacheUpdate > 1.0) + { + // the resource cache is cleared from the worker thread so that we're not holding up the main thread with delete operations + mWorkQueue->addWorkItem(new UpdateCacheItem(mResourceSystem, mTerrain, timestamp), true); + mLastResourceCacheUpdate = timestamp; + } } void CellPreloader::setExpiryDelay(double expiryDelay) diff --git a/apps/openmw/mwworld/cellpreloader.hpp b/apps/openmw/mwworld/cellpreloader.hpp index 35c52baf6..e45f92735 100644 --- a/apps/openmw/mwworld/cellpreloader.hpp +++ b/apps/openmw/mwworld/cellpreloader.hpp @@ -61,6 +61,8 @@ namespace MWWorld unsigned int mMaxCacheSize; bool mPreloadInstances; + double mLastResourceCacheUpdate; + struct PreloadEntry { PreloadEntry(double timestamp, osg::ref_ptr workItem)