diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-03-27 21:24:21 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-03-27 21:27:50 +0300 |
commit | 0eff9756494a268f6aa68b66ce4d09cb5aa5460a (patch) | |
tree | f3a9c040d8d9ce7d743ed8290ab1698e546c3ccc /indra | |
parent | b00e2da9e23f4dad9c754ce479253ac07eeec154 (diff) |
SL-18003 Basic dupplicate prevention
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llinventorymodelbackgroundfetch.cpp | 35 | ||||
-rw-r--r-- | indra/newview/llinventorymodelbackgroundfetch.h | 2 | ||||
-rw-r--r-- | indra/newview/llviewerinventory.cpp | 19 | ||||
-rw-r--r-- | indra/newview/llviewerinventory.h | 2 |
4 files changed, 46 insertions, 12 deletions
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index 4947c6bfe5..21f7e3e059 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -419,12 +419,19 @@ void LLInventoryModelBackgroundFetch::incrFetchCount(S32 fetching) } } -void ais_simple_callback(const LLUUID& inv_id) +void ais_simple_folder_callback(const LLUUID& inv_id) { LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1); + LLViewerInventoryCategory * cat(gInventory.getCategory(inv_id)); + if (cat) cat->setFetching(false); } -void LLInventoryModelBackgroundFetch::onAISCalback(const LLUUID &request_id, const LLUUID &response_id, ERecursionType recursion) +void ais_simple_item_callback(const LLUUID& inv_id) +{ + LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1); +} + +void LLInventoryModelBackgroundFetch::onAISFodlerCalback(const LLUUID &request_id, const LLUUID &response_id, ERecursionType recursion) { incrFetchCount(-1); if (response_id.isNull()) // Failure @@ -460,6 +467,13 @@ void LLInventoryModelBackgroundFetch::onAISCalback(const LLUUID &request_id, con gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); } } + + // done + LLViewerInventoryCategory * cat(gInventory.getCategory(request_id)); + if (cat) + { + cat->setFetching(false); + } } } @@ -497,11 +511,11 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis() curent_time = LLTimer::getTotalSeconds(); } - while (!mFetchFolderQueue.empty() && mFetchCount < max_concurrent_fetches && curent_time < end_time) + while (!mFetchItemQueue.empty() && mFetchCount < max_concurrent_fetches && curent_time < end_time) { - const FetchQueueInfo & fetch_info(mFetchFolderQueue.front()); + const FetchQueueInfo & fetch_info(mFetchItemQueue.front()); bulkFetchViaAis(fetch_info); - mFetchFolderQueue.pop_front(); + mFetchItemQueue.pop_front(); curent_time = LLTimer::getTotalSeconds(); } @@ -526,14 +540,14 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc else { - const LLViewerInventoryCategory * cat(gInventory.getCategory(cat_id)); + LLViewerInventoryCategory * cat(gInventory.getCategory(cat_id)); if (cat) { if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion()) { if (ALEXANDRIA_LINDEN_ID == cat->getOwnerID()) { - AISAPI::FetchCategoryChildren(cat->getUUID(), AISAPI::LIBRARY, fetch_info.mRecursive == RT_RECURSIVE, ais_simple_callback); + AISAPI::FetchCategoryChildren(cat->getUUID(), AISAPI::LIBRARY, fetch_info.mRecursive == RT_RECURSIVE, ais_simple_folder_callback); } else { @@ -545,10 +559,11 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc type == RT_RECURSIVE, [cat_id, type](const LLUUID &response_id) { - LLInventoryModelBackgroundFetch::instance().onAISCalback(cat_id, response_id, type); + LLInventoryModelBackgroundFetch::instance().onAISFodlerCalback(cat_id, response_id, type); }); } mFetchCount++; + cat->setFetching(true); } else { @@ -578,11 +593,11 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc { if (itemp->getPermissions().getOwner() == gAgent.getID()) { - AISAPI::FetchItem(itemp->getUUID(), AISAPI::INVENTORY, ais_simple_callback); + AISAPI::FetchItem(itemp->getUUID(), AISAPI::INVENTORY, ais_simple_item_callback); } else { - AISAPI::FetchItem(itemp->getUUID(), AISAPI::LIBRARY, ais_simple_callback); + AISAPI::FetchItem(itemp->getUUID(), AISAPI::LIBRARY, ais_simple_item_callback); } mFetchCount++; } diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h index 8d82f093d2..0a5608c0c6 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.h +++ b/indra/newview/llinventorymodelbackgroundfetch.h @@ -95,7 +95,7 @@ protected: }; typedef std::deque<FetchQueueInfo> fetch_queue_t; - void onAISCalback(const LLUUID &request_id, const LLUUID &response_id, ERecursionType recursion); + void onAISFodlerCalback(const LLUUID &request_id, const LLUUID &response_id, ERecursionType recursion); void bulkFetchViaAis(); void bulkFetchViaAis(const FetchQueueInfo& fetch_info); void bulkFetch(); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 6c7e815b04..6bd86f7902 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -659,7 +659,6 @@ bool LLViewerInventoryCategory::fetch() mDescendentsRequested.reset(); mDescendentsRequested.setTimerExpirySec(FETCH_TIMER_EXPIRY); - std::string url; if (gAgent.getRegion()) { @@ -678,6 +677,24 @@ bool LLViewerInventoryCategory::fetch() return false; } +void LLViewerInventoryCategory::setFetching(bool fetching) +{ + if (fetching) + { + if ((VERSION_UNKNOWN == getVersion()) + && mDescendentsRequested.hasExpired()) + { + const F32 FETCH_TIMER_EXPIRY = 10.0f; + mDescendentsRequested.reset(); + mDescendentsRequested.setTimerExpirySec(FETCH_TIMER_EXPIRY); + } + } + else + { + mDescendentsRequested.stop(); + } +} + S32 LLViewerInventoryCategory::getViewerDescendentCount() const { LLInventoryModel::cat_array_t* cats; diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 1554c84137..2ae2cebe5c 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -211,6 +211,8 @@ public: // Returns true if a fetch was issued. bool fetch(); + // Returns true if a fetch was issued. + void setFetching(bool); // used to help make caching more robust - for example, if // someone is getting 4 packets but logs out after 3. the viewer |