SL-19652 Folder fetch dupplicate protection and over limit handling

master
Andrey Kleshchev 2023-04-25 22:47:31 +03:00
parent 107b1d00ed
commit 1491eea28c
1 changed files with 43 additions and 1 deletions

View File

@ -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