@@ -287,6 +287,7 @@ class LLAsyncInventorySkeletonLoader
287287 void evaluateChildren (const FetchRequest& request, bool force_changed_scan);
288288 void discoverEssentialFolders ();
289289 void enqueueFetch (const LLUUID& category_id, bool is_library, bool essential, S32 cached_version);
290+ bool isCategoryUpToDate (const LLViewerInventoryCategory* cat, S32 cached_version) const ;
290291 AISAPI::ITEM_TYPE requestType (bool is_library) const ;
291292 void markEssentialReady ();
292293 void markComplete ();
@@ -612,6 +613,7 @@ void LLAsyncInventorySkeletonLoader::evaluateChildren(const FetchRequest& reques
612613 const bool child_changed = child_version_unknown
613614 || (cached_child_version == LLViewerInventoryCategory::VERSION_UNKNOWN)
614615 || (current_child_version != cached_child_version);
616+ const bool child_cache_valid = isCategoryUpToDate (child, cached_child_version);
615617
616618 const bool child_is_library = request.mIsLibrary
617619 || (child->getOwnerID () == gInventory .getLibraryOwnerID ());
@@ -631,16 +633,33 @@ void LLAsyncInventorySkeletonLoader::evaluateChildren(const FetchRequest& reques
631633 child_essential = true ;
632634 }
633635
636+ bool should_fetch = child_changed || force_changed_scan;
634637 if (child_essential)
635638 {
636- mEssentialPending .insert (child_id);
639+ if (!should_fetch && child_cache_valid)
640+ {
641+ mFetchedCategories .insert (child_id);
642+ continue ;
643+ }
644+
645+ if (!child_cache_valid)
646+ {
647+ should_fetch = true ;
648+ }
637649 }
638650
639- if ((child_changed || force_changed_scan || child_essential)
640- && mQueuedCategories .count (child_id) == 0 )
651+ if (should_fetch && mQueuedCategories .count (child_id) == 0 )
641652 {
653+ if (child_essential)
654+ {
655+ mEssentialPending .insert (child_id);
656+ }
642657 enqueueFetch (child_id, child_is_library, child_essential, cached_child_version);
643658 }
659+ else if (child_essential && child_cache_valid)
660+ {
661+ mFetchedCategories .insert (child_id);
662+ }
644663 }
645664}
646665
@@ -675,9 +694,16 @@ void LLAsyncInventorySkeletonLoader::discoverEssentialFolders()
675694 is_library = (cat->getOwnerID () == gInventory .getLibraryOwnerID ());
676695 }
677696
697+ const S32 cached_version = gInventory .getCachedCategoryVersion (cat_id);
698+ if (cat && isCategoryUpToDate (cat, cached_version))
699+ {
700+ mFetchedCategories .insert (cat_id);
701+ continue ;
702+ }
703+
678704 if (mFetchedCategories .count (cat_id) == 0 && mQueuedCategories .count (cat_id) == 0 && mActiveFetches .count (cat_id) == 0 )
679705 {
680- enqueueFetch (cat_id, is_library, true , gInventory . getCachedCategoryVersion (cat_id) );
706+ enqueueFetch (cat_id, is_library, true , cached_version );
681707 mEssentialPending .insert (cat_id);
682708 }
683709 }
@@ -689,8 +715,17 @@ void LLAsyncInventorySkeletonLoader::discoverEssentialFolders()
689715 && mActiveFetches .count (cof_id) == 0 )
690716 {
691717 mSawCurrentOutfitFolder = true ;
692- enqueueFetch (cof_id, false , true , gInventory .getCachedCategoryVersion (cof_id));
693- mEssentialPending .insert (cof_id);
718+ LLViewerInventoryCategory* cof = gInventory .getCategory (cof_id);
719+ const S32 cached_version = gInventory .getCachedCategoryVersion (cof_id);
720+ if (isCategoryUpToDate (cof, cached_version))
721+ {
722+ mFetchedCategories .insert (cof_id);
723+ }
724+ else
725+ {
726+ enqueueFetch (cof_id, false , true , cached_version);
727+ mEssentialPending .insert (cof_id);
728+ }
694729 }
695730}
696731
@@ -3261,6 +3296,31 @@ bool idle_startup()
32613296 return true ;
32623297}
32633298
3299+ bool LLAsyncInventorySkeletonLoader::isCategoryUpToDate (const LLViewerInventoryCategory* cat, S32 cached_version) const
3300+ {
3301+ if (!cat)
3302+ {
3303+ return false ;
3304+ }
3305+
3306+ if (cached_version == LLViewerInventoryCategory::VERSION_UNKNOWN)
3307+ {
3308+ return false ;
3309+ }
3310+
3311+ if (cat->getVersion () == LLViewerInventoryCategory::VERSION_UNKNOWN)
3312+ {
3313+ return false ;
3314+ }
3315+
3316+ if (cat->getDescendentCount () == LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN)
3317+ {
3318+ return false ;
3319+ }
3320+
3321+ return cat->getVersion () == cached_version;
3322+ }
3323+
32643324//
32653325// local function definition
32663326//
0 commit comments