summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorymodelbackgroundfetch.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2023-07-21 11:27:55 -0400
committerNat Goodspeed <nat@lindenlab.com>2023-07-21 11:27:55 -0400
commit25330b47f961b68df046665ce0576e6f23d1f3e5 (patch)
treedb84983b338972d1c332b45742c643f9d18c3fe3 /indra/newview/llinventorymodelbackgroundfetch.cpp
parent248f78b45ec9ee275f3b97e50b9962f2e54dbde2 (diff)
parentec4135da63a3f3877222fba4ecb59b15650371fe (diff)
SL-18837: Merge branch 'main' of secondlife/viewer into actions
Diffstat (limited to 'indra/newview/llinventorymodelbackgroundfetch.cpp')
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.cpp66
1 files changed, 64 insertions, 2 deletions
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index 4a9b471a47..f544b318d6 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -30,8 +30,10 @@
#include "llagent.h"
#include "llappviewer.h"
#include "llcallbacklist.h"
-#include "llinventorypanel.h"
#include "llinventorymodel.h"
+#include "llinventorypanel.h"
+#include "llnotificationsutil.h"
+#include "llstartup.h"
#include "llviewercontrol.h"
#include "llviewerinventory.h"
#include "llviewermessage.h"
@@ -408,6 +410,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch()
// *TODO: Think I'd like to get a shared pointer to this and share it
// among all the folder requests.
uuid_vec_t recursive_cats;
+ uuid_vec_t all_cats; // dupplicate avoidance
LLSD folder_request_body;
LLSD folder_request_body_lib;
@@ -438,7 +441,8 @@ void LLInventoryModelBackgroundFetch::bulkFetch()
if (cat)
{
- if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
+ if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion()
+ && std::find(all_cats.begin(), all_cats.end(), cat_id) == all_cats.end())
{
LLSD folder_sd;
folder_sd["folder_id"] = cat->getUUID();
@@ -477,6 +481,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch()
{
recursive_cats.push_back(cat_id);
}
+ all_cats.push_back(cat_id);
}
else
{
@@ -796,6 +801,63 @@ void BGFolderHttpHandler::processFailure(LLCore::HttpStatus status, LLCore::Http
<< LLCoreHttpUtil::responseToString(response) << "]" << LL_ENDL;
// Could use a 404 test here to try to detect revoked caps...
+
+ if(status == LLCore::HttpStatus(HTTP_FORBIDDEN))
+ {
+ // Too large, split into two if possible
+ if (gDisconnected || LLApp::isExiting())
+ {
+ return;
+ }
+
+ const std::string url(gAgent.getRegionCapability("FetchInventoryDescendents2"));
+ if (url.empty())
+ {
+ LL_WARNS(LOG_INV) << "Failed to get AIS2 cap" << LL_ENDL;
+ return;
+ }
+
+ S32 size = mRequestSD["folders"].size();
+
+ if (size > 1)
+ {
+ // Can split, assume that this isn't the library
+ LLSD folders;
+ uuid_vec_t recursive_cats;
+ LLSD::array_iterator iter = mRequestSD["folders"].beginArray();
+ LLSD::array_iterator end = mRequestSD["folders"].endArray();
+ while (iter != end)
+ {
+ folders.append(*iter);
+ LLUUID fodler_id = iter->get("folder_id").asUUID();
+ if (std::find(mRecursiveCatUUIDs.begin(), mRecursiveCatUUIDs.end(), fodler_id) != mRecursiveCatUUIDs.end())
+ {
+ recursive_cats.push_back(fodler_id);
+ }
+ if (folders.size() == (S32)(size / 2))
+ {
+ LLSD request_body;
+ request_body["folders"] = folders;
+ LLCore::HttpHandler::ptr_t handler(new BGFolderHttpHandler(request_body, recursive_cats));
+ gInventory.requestPost(false, url, request_body, handler, "Inventory Folder");
+ recursive_cats.clear();
+ folders.clear();
+ }
+ iter++;
+ }
+
+ LLSD request_body;
+ request_body["folders"] = folders;
+ LLCore::HttpHandler::ptr_t handler(new BGFolderHttpHandler(request_body, recursive_cats));
+ gInventory.requestPost(false, url, request_body, handler, "Inventory Folder");
+ return;
+ }
+ else
+ {
+ // Can't split
+ LLNotificationsUtil::add("InventoryLimitReachedAIS");
+ }
+ }
// This was originally the request retry logic for the inventory
// request which tested on HTTP_INTERNAL_ERROR status. This