summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-03-15 20:03:53 +0200
committerakleshchev <117672381+akleshchev@users.noreply.github.com>2023-03-15 20:18:38 +0200
commit7a70d93c437a7065b0c0be7fa63d36f511a9cef2 (patch)
tree3f79f27b7e387afbe23f189d51c2123c53ec092d /indra/newview
parent83811ff846d9c046e694708c209a6d4dc0bb45a3 (diff)
SL-18629 Fetch Inventory using AIS caps #3
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llaisapi.cpp28
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.cpp50
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.h1
3 files changed, 39 insertions, 40 deletions
diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp
index 23bb123dee..bb963d77c9 100644
--- a/indra/newview/llaisapi.cpp
+++ b/indra/newview/llaisapi.cpp
@@ -901,7 +901,25 @@ void AISUpdate::parseLink(const LLSD& link_map)
void AISUpdate::parseCategory(const LLSD& category_map)
{
- LLUUID category_id = category_map["category_id"].asUUID();
+ LLUUID category_id = category_map["category_id"].asUUID();
+ S32 version = LLViewerInventoryCategory::VERSION_UNKNOWN;
+
+ if (category_map.has("version"))
+ {
+ version = category_map["version"].asInteger();
+ }
+
+ LLViewerInventoryCategory *curr_cat = gInventory.getCategory(category_id);
+
+ if (curr_cat
+ && curr_cat->getVersion() > LLViewerInventoryCategory::VERSION_UNKNOWN
+ && version > LLViewerInventoryCategory::VERSION_UNKNOWN
+ && version < curr_cat->getVersion())
+ {
+ LL_WARNS() << "Got stale folder, known: " << curr_cat->getVersion()
+ << ", received: " << version << LL_ENDL;
+ return;
+ }
// Check descendent count first, as it may be needed
// to populate newly created categories
@@ -911,7 +929,6 @@ void AISUpdate::parseCategory(const LLSD& category_map)
}
LLPointer<LLViewerInventoryCategory> new_cat;
- LLViewerInventoryCategory *curr_cat = gInventory.getCategory(category_id);
if (curr_cat)
{
// Default to current values where not provided.
@@ -940,11 +957,10 @@ void AISUpdate::parseCategory(const LLSD& category_map)
if (mFetch)
{
// Set version/descendents for newly created categories.
- if (category_map.has("version"))
+ if (version > LLViewerInventoryCategory::VERSION_UNKNOWN)
{
- S32 version = category_map["version"].asInteger();
LL_DEBUGS("Inventory") << "Setting version to " << version
- << " for new category " << category_id << LL_ENDL;
+ << " for category " << category_id << LL_ENDL;
new_cat->setVersion(version);
}
uuid_int_map_t::const_iterator lookup_it = mCatDescendentsKnown.find(category_id);
@@ -952,7 +968,7 @@ void AISUpdate::parseCategory(const LLSD& category_map)
{
S32 descendent_count = lookup_it->second;
LL_DEBUGS("Inventory") << "Setting descendents count to " << descendent_count
- << " for new category " << category_id << LL_ENDL;
+ << " for category " << category_id << LL_ENDL;
new_cat->setDescendentCount(descendent_count);
}
mCategoriesCreated[category_id] = new_cat;
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index 5ea8fe4cba..098ced4ec9 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -276,7 +276,7 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive)
// Not only root folder can be massive, but
// most system folders will be requested independently
// so request root folder and content separately
- mRecursiveFetchQueue.push_back(FetchQueueInfo(gInventory.getRootFolderID(), RT_CONTENT));
+ mFetchQueue.push_front(FetchQueueInfo(gInventory.getRootFolderID(), RT_CONTENT));
}
else
{
@@ -287,25 +287,18 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive)
if (! mRecursiveLibraryFetchStarted)
{
mRecursiveLibraryFetchStarted |= recursive;
- if (recursive && AISAPI::isAvailable())
- {
- mRecursiveFetchQueue.push_back(FetchQueueInfo(gInventory.getLibraryRootFolderID(), recursion_type));
- }
- else
- {
- mFetchQueue.push_back(FetchQueueInfo(gInventory.getLibraryRootFolderID(), recursion_type));
- }
+ mFetchQueue.push_back(FetchQueueInfo(gInventory.getLibraryRootFolderID(), recursion_type));
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
}
}
else
{
- if (recursive && AISAPI::isAvailable())
+ if (AISAPI::isAvailable() && !recursive)
{
- // AIS does depth requests, recursive requests will need to be prioritizes
- if (mRecursiveFetchQueue.empty() || mRecursiveFetchQueue.back().mUUID != id)
+ // Specific folder requests go to front of queue.
+ if (mFetchQueue.empty() || mFetchQueue.back().mUUID != id)
{
- mRecursiveFetchQueue.push_back(FetchQueueInfo(id, recursion_type));
+ mFetchQueue.push_back(FetchQueueInfo(id, recursion_type));
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
}
}
@@ -318,6 +311,7 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive)
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
}
}
+
if (id == gInventory.getLibraryRootFolderID())
{
mRecursiveLibraryFetchStarted |= recursive;
@@ -409,7 +403,7 @@ void LLInventoryModelBackgroundFetch::onAISCalback(const LLUUID &request_id, con
// Try requesting folder and nested content separately
mBackgroundFetchActive = true;
mFolderFetchActive = true;
- mRecursiveFetchQueue.push_back(FetchQueueInfo(request_id, RT_CONTENT));
+ mFetchQueue.push_front(FetchQueueInfo(request_id, RT_CONTENT));
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
}
}
@@ -425,7 +419,13 @@ void LLInventoryModelBackgroundFetch::onAISCalback(const LLUUID &request_id, con
it != categories->end();
++it)
{
- mRecursiveFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(), RT_RECURSIVE));
+ mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(), RT_RECURSIVE));
+ }
+ if (!mFetchQueue.empty())
+ {
+ mBackgroundFetchActive = true;
+ mFolderFetchActive = true;
+ gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
}
}
}
@@ -442,22 +442,13 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis()
return;
}
- static const S32 max_concurrent_fetches(12);
+ static const S32 max_concurrent_fetches(50);
if (mFetchCount >= max_concurrent_fetches)
{
return;
}
- // Start with recursive queue since it can get multiple categories
- // in a single request and might contain what other requests want
- while (!mRecursiveFetchQueue.empty() && mFetchCount < max_concurrent_fetches)
- {
- const FetchQueueInfo & fetch_info(mRecursiveFetchQueue.front());
- bulkFetchViaAis(fetch_info);
- mRecursiveFetchQueue.pop_front();
- }
-
while (!mFetchQueue.empty() && mFetchCount < max_concurrent_fetches)
{
const FetchQueueInfo & fetch_info(mFetchQueue.front());
@@ -522,7 +513,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc
it != categories->end();
++it)
{
- mRecursiveFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(), fetch_info.mRecursive));
+ mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(), fetch_info.mRecursive));
}
}
}
@@ -598,13 +589,6 @@ void LLInventoryModelBackgroundFetch::bulkFetch()
LLSD item_request_body;
LLSD item_request_body_lib;
- if (!mRecursiveFetchQueue.empty())
- {
- LL_DEBUGS(LOG_INV) << "Request was sheduled for AIS, using legacy" << LL_ENDL;
- mFetchQueue.insert(mFetchQueue.begin(), mRecursiveFetchQueue.begin(), mRecursiveFetchQueue.end());
- mRecursiveFetchQueue.clear();
- }
-
while (! mFetchQueue.empty()
&& (item_count + folder_count) < max_batch_size)
{
diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h
index 4c4de6ac7c..14557ea92d 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.h
+++ b/indra/newview/llinventorymodelbackgroundfetch.h
@@ -114,7 +114,6 @@ private:
LLFrameTimer mFetchTimer;
F32 mMinTimeBetweenFetches;
fetch_queue_t mFetchQueue;
- fetch_queue_t mRecursiveFetchQueue;
};