From 0aadedc98047a108b0ab1fa55c397e6da3e6ddeb Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Mon, 16 Mar 2020 15:21:44 +0200
Subject: [PATCH] SL-5668 Background fetch loop

---
 indra/newview/llinventoryfilter.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index 745b953996d..b57bc5a4ed6 100644
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -192,10 +192,15 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const
 	// when applying a filter, matching folders get their contents downloaded first
 	// but make sure we are not interfering with pre-download
 	if (isNotDefault()
-		&& !gInventory.isCategoryComplete(folder_id)
 		&& LLStartUp::getStartupState() > STATE_WEARABLES_WAIT)
-	{
-		LLInventoryModelBackgroundFetch::instance().start(folder_id);
+    {
+        LLViewerInventoryCategory* cat = gInventory.getCategory(folder_id);
+        if (!cat || (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN))
+        {
+            // At the moment background fetch only cares about VERSION_UNKNOWN,
+            // so do not check isCategoryComplete that compares descendant count
+            LLInventoryModelBackgroundFetch::instance().start(folder_id);
+        }
 	}
 
 	// Marketplace folder filtering
-- 
GitLab