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 bulkmaster
parent
728a91b288
commit
38fbe5267b
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue