summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorymodelbackgroundfetch.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-11-30 00:21:46 +0200
committerakleshchev <117672381+akleshchev@users.noreply.github.com>2023-12-06 01:02:42 +0200
commit38fbe5267bef11d57cb3ad7795c3a9b602e414c5 (patch)
tree00f1681f6902f54afc7884aad3b2686dc20eb80b /indra/newview/llinventorymodelbackgroundfetch.cpp
parent728a91b288c88131db032db687a3e6f0e0a09301 (diff)
SL-20181 Optimize marketplace fetch request
- Move it to the back unless requested by floater (prioritize main inventory) - Instead of fetching whole folder which likely has pending changes from web side, fetch folder individually, then fetch changed content in bulk
Diffstat (limited to 'indra/newview/llinventorymodelbackgroundfetch.cpp')
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.cpp67
1 files changed, 46 insertions, 21 deletions
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index f1c5104e76..493fb139ac 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -193,13 +193,16 @@ LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch():
mLastFetchCount(0),
mFetchFolderCount(0),
mAllRecursiveFoldersFetched(false),
- mRecursiveInventoryFetchStarted(false),
- mRecursiveLibraryFetchStarted(false),
- mMinTimeBetweenFetches(0.3f)
+ mRecursiveInventoryFetchStarted(false),
+ mRecursiveLibraryFetchStarted(false),
+ mRecursiveMarketplaceFetchStarted(false),
+ mMinTimeBetweenFetches(0.3f)
{}
LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch()
-{}
+{
+ gIdleCallbacks.deleteFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
+}
bool LLInventoryModelBackgroundFetch::isBulkFetchProcessingComplete() const
{
@@ -314,6 +317,23 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive)
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
}
}
+ else if (cat && cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_LISTINGS)
+ {
+ if (mFetchFolderQueue.empty() || mFetchFolderQueue.back().mUUID != id)
+ {
+ if (recursive && AISAPI::isAvailable())
+ {
+ // Request marketplace folder and content separately
+ mFetchFolderQueue.push_front(FetchQueueInfo(id, FT_FOLDER_AND_CONTENT));
+ }
+ else
+ {
+ mFetchFolderQueue.push_front(FetchQueueInfo(id, recursion_type));
+ }
+ gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
+ mRecursiveMarketplaceFetchStarted = true;
+ }
+ }
else
{
if (AISAPI::isAvailable())
@@ -724,7 +744,26 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis()
if (isFolderFetchProcessingComplete() && mFolderFetchActive)
{
- setAllFoldersFetched();
+ if (!mRecursiveInventoryFetchStarted || mRecursiveMarketplaceFetchStarted)
+ {
+ setAllFoldersFetched();
+ }
+ else
+ {
+ // Intent is for marketplace request to happen after
+ // main inventory is done, unless requested by floater
+ mRecursiveMarketplaceFetchStarted = true;
+ const LLUUID& marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
+ if (marketplacelistings_id.notNull())
+ {
+ mFetchFolderQueue.push_front(FetchQueueInfo(marketplacelistings_id, FT_FOLDER_AND_CONTENT));
+ }
+ else
+ {
+ setAllFoldersFetched();
+ }
+ }
+
}
if (isBulkFetchProcessingComplete())
@@ -784,22 +823,8 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc
if (child_cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_LISTINGS)
{
- // special case
- content_done = false;
- if (children.empty())
- {
- // fetch marketplace alone
- // Should it actually be fetched as FT_FOLDER_AND_CONTENT?
- children.push_back(child_cat->getUUID());
- mExpectedFolderIds.push_back(child_cat->getUUID());
- child_cat->setFetching(target_state);
- break;
- }
- else
- {
- // fetch marketplace alone next run
- continue;
- }
+ // special case, marketplace will fetch that as needed
+ continue;
}
children.push_back(child_cat->getUUID());