summaryrefslogtreecommitdiff
path: root/indra/newview
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
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')
-rw-r--r--indra/newview/llfloatermarketplacelistings.cpp25
-rw-r--r--indra/newview/llfloatermarketplacelistings.h4
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.cpp67
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.h3
4 files changed, 67 insertions, 32 deletions
diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp
index 71b3b16809..6216f4e39a 100644
--- a/indra/newview/llfloatermarketplacelistings.cpp
+++ b/indra/newview/llfloatermarketplacelistings.cpp
@@ -183,7 +183,8 @@ void LLPanelMarketplaceListings::draw()
// Get the audit button enabled only after the whole inventory is fetched
if (!mAuditBtn->getEnabled())
{
- mAuditBtn->setEnabled(LLInventoryModelBackgroundFetch::instance().isEverythingFetched());
+ LLInventoryModelBackgroundFetch* inst = LLInventoryModelBackgroundFetch::getInstance();
+ mAuditBtn->setEnabled(inst->isEverythingFetched() && !inst->folderFetchActive());
}
LLPanel::draw();
@@ -410,8 +411,14 @@ BOOL LLFloaterMarketplaceListings::postBuild()
mCategoryAddedObserver = new LLMarketplaceListingsAddedObserver(this);
gInventory.addObserver(mCategoryAddedObserver);
- // Fetch aggressively so we can interact with listings right onOpen()
- fetchContents();
+
+ // Fetch aggressively so we can interact with listings as soon as possible
+ if (!fetchContents())
+ {
+ const LLUUID& marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
+ LLInventoryModelBackgroundFetch::instance().start(marketplacelistings_id, true);
+ }
+
return TRUE;
}
@@ -440,17 +447,19 @@ void LLFloaterMarketplaceListings::onFocusReceived()
updateView();
}
-void LLFloaterMarketplaceListings::fetchContents()
+bool LLFloaterMarketplaceListings::fetchContents()
{
- if (mRootFolderId.notNull() &&
+ if (mRootFolderId.notNull() &&
(LLMarketplaceData::instance().getSLMDataFetched() != MarketplaceFetchCodes::MARKET_FETCH_LOADING) &&
(LLMarketplaceData::instance().getSLMDataFetched() != MarketplaceFetchCodes::MARKET_FETCH_DONE))
- {
+ {
LLMarketplaceData::instance().setDataFetchedSignal(boost::bind(&LLFloaterMarketplaceListings::updateView, this));
LLMarketplaceData::instance().setSLMDataFetched(MarketplaceFetchCodes::MARKET_FETCH_LOADING);
- LLInventoryModelBackgroundFetch::instance().start(mRootFolderId, true);
+ LLInventoryModelBackgroundFetch::instance().start(mRootFolderId, true);
LLMarketplaceData::instance().getSLMListings();
- }
+ return true;
+ }
+ return false;
}
void LLFloaterMarketplaceListings::setRootFolder()
diff --git a/indra/newview/llfloatermarketplacelistings.h b/indra/newview/llfloatermarketplacelistings.h
index 085e517a9d..78d43f97a9 100644
--- a/indra/newview/llfloatermarketplacelistings.h
+++ b/indra/newview/llfloatermarketplacelistings.h
@@ -114,8 +114,8 @@ public:
protected:
void setRootFolder();
void setPanels();
- void fetchContents();
-
+ bool fetchContents();
+
void setStatusString(const std::string& statusString);
void onClose(bool app_quitting);
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());
diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h
index 5d66985b40..3343b4dd4e 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.h
+++ b/indra/newview/llinventorymodelbackgroundfetch.h
@@ -69,7 +69,6 @@ public:
void incrFetchFolderCount(S32 fetching);
bool isBulkFetchProcessingComplete() const;
- bool isFolderFetchProcessingComplete() const;
void setAllFoldersFetched();
typedef boost::function<void()> folders_fetched_callback_t;
@@ -79,6 +78,7 @@ public:
void addRequestAtBack(const LLUUID & id, bool recursive, bool is_category);
protected:
+ bool isFolderFetchProcessingComplete() const;
typedef enum {
FT_DEFAULT = 0,
@@ -115,6 +115,7 @@ protected:
private:
bool mRecursiveInventoryFetchStarted;
bool mRecursiveLibraryFetchStarted;
+ bool mRecursiveMarketplaceFetchStarted; // AIS3 specific
bool mAllRecursiveFoldersFetched;
typedef boost::signals2::signal<void()> folders_fetched_signal_t;
folders_fetched_signal_t mFoldersFetchedSignal;