From 5e59ab0ab77d91f9d855bd5a3fc0e5c691220f01 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 11 Apr 2023 23:12:32 +0300 Subject: SL-19533 Further logging improvements --- indra/newview/llaisapi.cpp | 65 +++++++++++++++++++++-- indra/newview/llinventorymodelbackgroundfetch.cpp | 26 ++++++--- indra/newview/llinventorymodelbackgroundfetch.h | 1 + indra/newview/llviewerinventory.cpp | 2 +- 4 files changed, 82 insertions(+), 12 deletions(-) diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp index 1efba0db7a..92589540f1 100644 --- a/indra/newview/llaisapi.cpp +++ b/indra/newview/llaisapi.cpp @@ -29,6 +29,7 @@ #include "llaisapi.h" #include "llagent.h" +#include "llappviewer.h" #include "llcallbacklist.h" #include "llinventorymodel.h" #include "llsdutil.h" @@ -95,7 +96,10 @@ void AISAPI::CreateInventory(const LLUUID& parentId, const LLSD& newInventory, c if (cap.empty()) { LL_WARNS("Inventory") << "Inventory cap not found!" << LL_ENDL; - callback(LLUUID::null); + if (callback) + { + callback(LLUUID::null); + } return; } @@ -138,6 +142,10 @@ void AISAPI::SlamFolder(const LLUUID& folderId, const LLSD& newInventory, comple if (cap.empty()) { LL_WARNS("Inventory") << "Inventory cap not found!" << LL_ENDL; + if (callback) + { + callback(LLUUID::null); + } return; } @@ -173,6 +181,10 @@ void AISAPI::RemoveCategory(const LLUUID &categoryId, completion_t callback) if (cap.empty()) { LL_WARNS("Inventory") << "Inventory cap not found!" << LL_ENDL; + if (callback) + { + callback(LLUUID::null); + } return; } @@ -206,6 +218,10 @@ void AISAPI::RemoveItem(const LLUUID &itemId, completion_t callback) if (cap.empty()) { LL_WARNS("Inventory") << "Inventory cap not found!" << LL_ENDL; + if (callback) + { + callback(LLUUID::null); + } return; } @@ -238,6 +254,10 @@ void AISAPI::CopyLibraryCategory(const LLUUID& sourceId, const LLUUID& destId, b if (cap.empty()) { LL_WARNS("Inventory") << "Library cap not found!" << LL_ENDL; + if (callback) + { + callback(LLUUID::null); + } return; } @@ -282,6 +302,10 @@ void AISAPI::PurgeDescendents(const LLUUID &categoryId, completion_t callback) if (cap.empty()) { LL_WARNS("Inventory") << "Inventory cap not found!" << LL_ENDL; + if (callback) + { + callback(LLUUID::null); + } return; } @@ -316,6 +340,10 @@ void AISAPI::UpdateCategory(const LLUUID &categoryId, const LLSD &updates, compl if (cap.empty()) { LL_WARNS("Inventory") << "Inventory cap not found!" << LL_ENDL; + if (callback) + { + callback(LLUUID::null); + } return; } std::string url = cap + std::string("/category/") + categoryId.asString(); @@ -348,6 +376,10 @@ void AISAPI::UpdateItem(const LLUUID &itemId, const LLSD &updates, completion_t if (cap.empty()) { LL_WARNS("Inventory") << "Inventory cap not found!" << LL_ENDL; + if (callback) + { + callback(LLUUID::null); + } return; } std::string url = cap + std::string("/item/") + itemId.asString(); @@ -379,6 +411,10 @@ void AISAPI::FetchItem(const LLUUID &itemId, ITEM_TYPE type, completion_t callba if (cap.empty()) { LL_WARNS("Inventory") << "Inventory cap not found!" << LL_ENDL; + if (callback) + { + callback(LLUUID::null); + } return; } std::string url = cap + std::string("/item/") + itemId.asString(); @@ -410,7 +446,10 @@ void AISAPI::FetchCategoryChildren(const LLUUID &catId, ITEM_TYPE type, bool rec if (cap.empty()) { LL_WARNS("Inventory") << "Inventory cap not found!" << LL_ENDL; - callback(LLUUID::null); + if (callback) + { + callback(LLUUID::null); + } return; } std::string url = cap + std::string("/category/") + catId.asString() + "/children"; @@ -456,7 +495,10 @@ void AISAPI::FetchCategoryChildren(const std::string &identifier, bool recursive if (cap.empty()) { LL_WARNS("Inventory") << "Inventory cap not found!" << LL_ENDL; - callback(LLUUID::null); + if (callback) + { + callback(LLUUID::null); + } return; } std::string url = cap + std::string("/category/") + identifier + "/children"; @@ -500,6 +542,10 @@ void AISAPI::FetchCategoryCategories(const LLUUID &catId, ITEM_TYPE type, bool r if (cap.empty()) { LL_WARNS("Inventory") << "Inventory cap not found!" << LL_ENDL; + if (callback) + { + callback(LLUUID::null); + } return; } std::string url = cap + std::string("/category/") + catId.asString() + "/categories"; @@ -541,6 +587,10 @@ void AISAPI::FetchOrphans(completion_t callback) if (cap.empty()) { LL_WARNS("Inventory") << "Inventory cap not found!" << LL_ENDL; + if (callback) + { + callback(LLUUID::null); + } return; } std::string url = cap + std::string("/orphans"); @@ -642,6 +692,15 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht invokationFn_t invoke, std::string url, LLUUID targetId, LLSD body, completion_t callback, COMMAND_TYPE type) { + if (gDisconnected) + { + if (callback) + { + callback(LLUUID::null); + } + return; + } + LLCore::HttpOptions::ptr_t httpOptions(new LLCore::HttpOptions); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); LLCore::HttpHeaders::ptr_t httpHeaders; diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index 0099e81b8f..955f152195 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -190,6 +190,7 @@ LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch(): mBackgroundFetchActive(false), mFolderFetchActive(false), mFetchCount(0), + mLastFetchCount(0), mFetchFolderCount(0), mAllRecursiveFoldersFetched(false), mRecursiveInventoryFetchStarted(false), @@ -424,13 +425,13 @@ void LLInventoryModelBackgroundFetch::backgroundFetchCB(void *) void LLInventoryModelBackgroundFetch::backgroundFetch() { - if (mBackgroundFetchActive && gAgent.getRegion() && gAgent.getRegion()->capabilitiesReceived()) + if (mBackgroundFetchActive) { if (AISAPI::isAvailable()) { bulkFetchViaAis(); } - else + else if (gAgent.getRegion() && gAgent.getRegion()->capabilitiesReceived()) { // If we'll be using the capability, we'll be sending batches and the background thing isn't as important. bulkFetch(); @@ -460,6 +461,7 @@ void LLInventoryModelBackgroundFetch::incrFetchFolderCount(S32 fetching) void ais_simple_folder_callback(const LLUUID& inv_id) { + LL_DEBUGS("AIS3") << "Response for folder " << inv_id << LL_ENDL; LLInventoryModelBackgroundFetch::instance().incrFetchFolderCount(-1); if (inv_id.notNull()) // null normally means a failure, but is an expected response for orphans { @@ -473,6 +475,7 @@ void ais_simple_folder_callback(const LLUUID& inv_id) void ais_simple_item_callback(const LLUUID& inv_id) { + LL_DEBUGS("AIS3") << "Response for " << inv_id << LL_ENDL; LLInventoryModelBackgroundFetch::instance().incrFetchCount(-1); } @@ -481,6 +484,7 @@ void LLInventoryModelBackgroundFetch::onAISFodlerCalback(const LLUUID &request_i incrFetchFolderCount(-1); if (response_id.isNull()) // Failure { + LL_DEBUGS("AIS3") << "Failure response for folder " << request_id << LL_ENDL; if (recursion == FT_RECURSIVE) { // A full recursive request failed. @@ -513,6 +517,7 @@ void LLInventoryModelBackgroundFetch::onAISFodlerCalback(const LLUUID &request_i } else { + LL_DEBUGS("AIS3") << "Got folder " << request_id << LL_ENDL; if (recursion == FT_CONTENT_RECURSIVE) { // Got the folder, now recursively request content @@ -567,6 +572,7 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis() ? 0.006f // 6 ms : 1.f; const F64 end_time = curent_time + max_time; + S32 last_fetch_count = mFetchCount; while (!mFetchFolderQueue.empty() && mFetchCount < max_concurrent_fetches && curent_time < end_time) { @@ -589,10 +595,15 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis() } } - LL_DEBUGS(LOG_INV , "AIS3") << "Total active fetches: " << mFetchCount - << ", scheduled fodler fetches: " << (S32)mFetchFolderQueue.size() - << ", scheduled item fetches: " << (S32)mFetchItemQueue.size() - << LL_ENDL; + if (last_fetch_count != mFetchCount // if anything was added + || mLastFetchCount != mFetchCount) // if anything was substracted + { + mLastFetchCount = mFetchCount; + LL_DEBUGS(LOG_INV , "AIS3") << "Total active fetches: " << last_fetch_count << "->" << mFetchCount + << ", scheduled fodler fetches: " << (S32)mFetchFolderQueue.size() + << ", scheduled item fetches: " << (S32)mFetchItemQueue.size() + << LL_ENDL; + } if (isFolderFetchProcessingComplete() && mFolderFetchActive) { @@ -619,7 +630,6 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc } else { - LLViewerInventoryCategory * cat(gInventory.getCategory(cat_id)); if (cat) { @@ -630,9 +640,9 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc ? LLViewerInventoryCategory::FETCH_RECURSIVE : LLViewerInventoryCategory::FETCH_NORMAL; // start again if we did a non-recursive fetch before + // to get all children in a single request if (cat->getFetching() < target_state) { - if (ALEXANDRIA_LINDEN_ID == cat->getOwnerID()) { AISAPI::FetchCategoryChildren(cat->getUUID(), AISAPI::LIBRARY, fetch_info.mFetchType == FT_RECURSIVE, ais_simple_folder_callback); diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h index bd54c17c8d..6c2c3e96fa 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.h +++ b/indra/newview/llinventorymodelbackgroundfetch.h @@ -120,6 +120,7 @@ private: bool mBackgroundFetchActive; bool mFolderFetchActive; S32 mFetchCount; + S32 mLastFetchCount; // for debug S32 mFetchFolderCount; LLFrameTimer mFetchTimer; diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index c4edc3952b..cd51a00c52 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -689,7 +689,7 @@ void LLViewerInventoryCategory::setFetching(LLViewerInventoryCategory::EFetchTyp { if (mDescendentsRequested.hasExpired() || (mFetching == FETCH_NONE)) { - const F32 FETCH_TIMER_EXPIRY = 10.0f; + const F32 FETCH_TIMER_EXPIRY = 30.0f; mDescendentsRequested.reset(); mDescendentsRequested.setTimerExpirySec(FETCH_TIMER_EXPIRY); } -- cgit v1.2.3