summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorymodelbackgroundfetch.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-04-25 22:47:31 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-04-25 22:47:31 +0300
commit1491eea28c9355ba3d69ce566ae5263e69db3daf (patch)
tree266bd45ee53c73163af03770bb244fb4788731cd /indra/newview/llinventorymodelbackgroundfetch.cpp
parent107b1d00ed5d272cd87a6ca333cd719151208eaa (diff)
SL-19652 Folder fetch dupplicate protection and over limit handling
Diffstat (limited to 'indra/newview/llinventorymodelbackgroundfetch.cpp')
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.cpp44
1 files changed, 43 insertions, 1 deletions
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index 4a9b471a47..0bb56c7d0c 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -408,6 +408,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;
@@ -436,7 +437,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch()
{
const LLViewerInventoryCategory * cat(gInventory.getCategory(cat_id));
- if (cat)
+ if (cat && std::find(all_cats.begin(), all_cats.end(), cat_id) == all_cats.end())
{
if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
{
@@ -477,6 +478,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch()
{
recursive_cats.push_back(cat_id);
}
+ all_cats.push_back(cat_id);
}
else
{
@@ -796,6 +798,46 @@ 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, assume that this isn't the library
+ const std::string url(gAgent.getRegionCapability("FetchInventoryDescendents2"));
+ S32 size = mRequestSD["folders"].size();
+
+ if (!gDisconnected && !LLApp::isExiting() && !url.empty() && size > 1)
+ {
+ 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;
+ }
+ }
// This was originally the request retry logic for the inventory
// request which tested on HTTP_INTERNAL_ERROR status. This