SL-18629 Fetch Inventory using AIS caps #3
parent
83811ff846
commit
7a70d93c43
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -114,7 +114,6 @@ private:
|
|||
LLFrameTimer mFetchTimer;
|
||||
F32 mMinTimeBetweenFetches;
|
||||
fetch_queue_t mFetchQueue;
|
||||
fetch_queue_t mRecursiveFetchQueue;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue