From aee8f570e14684e6143a18541ba0bc9a5060fa98 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 29 Sep 2023 21:27:37 +0300 Subject: SL-20368 Request outfits using 'links' instead of getting items one by one --- indra/newview/llappearancemgr.cpp | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 8010b84c20..667ae999bb 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2776,9 +2776,33 @@ void LLAppearanceMgr::wearInventoryCategory(LLInventoryCategory* category, bool else { selfStartPhase("wear_inventory_category_fetch"); - callAfterCategoryFetch(category->getUUID(),boost::bind(&LLAppearanceMgr::wearCategoryFinal, - &LLAppearanceMgr::instance(), - category->getUUID(), copy, append)); + if (AISAPI::isAvailable() && category->getPreferredType() == LLFolderType::FT_OUTFIT) + { + // for reliability just fetch it whole, linked items included + LLViewerInventoryCategory* cat = (LLViewerInventoryCategory*)category; + LLUUID cat_id = category->getUUID(); + cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE); + AISAPI::FetchCategoryLinks(cat_id, + [cat_id, copy, append](const LLUUID& id) + { + LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); + if (cat) + { + cat->setFetching(LLViewerInventoryCategory::FETCH_NONE); + } + if (id.isNull()) + { + LL_WARNS() << "failed to fetch category, attempting to wear as is " << cat_id << LL_ENDL; + } + LLAppearanceMgr::instance().wearCategoryFinal(cat_id, copy, append); + }); + } + else + { + callAfterCategoryFetch(category->getUUID(), boost::bind(&LLAppearanceMgr::wearCategoryFinal, + &LLAppearanceMgr::instance(), + category->getUUID(), copy, append)); + } } } @@ -2787,7 +2811,7 @@ S32 LLAppearanceMgr::getActiveCopyOperations() const return LLCallAfterInventoryCopyMgr::getInstanceCount(); } -void LLAppearanceMgr::wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool append) +void LLAppearanceMgr::wearCategoryFinal(const LLUUID& cat_id, bool copy_items, bool append) { LL_INFOS("Avatar") << self_av_string() << "starting" << LL_ENDL; -- cgit v1.2.3 From cebbdf2d129c0c039385125454d9198f42e7e596 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 11 Oct 2023 22:34:00 +0300 Subject: SL-20436 New accounts that select outfit in web fail to download clothing --- indra/newview/llappearancemgr.cpp | 72 +++++++++++---------------------------- 1 file changed, 19 insertions(+), 53 deletions(-) (limited to 'indra/newview/llappearancemgr.cpp') diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 667ae999bb..4c3a9229d2 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2779,23 +2779,13 @@ void LLAppearanceMgr::wearInventoryCategory(LLInventoryCategory* category, bool if (AISAPI::isAvailable() && category->getPreferredType() == LLFolderType::FT_OUTFIT) { // for reliability just fetch it whole, linked items included - LLViewerInventoryCategory* cat = (LLViewerInventoryCategory*)category; LLUUID cat_id = category->getUUID(); - cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE); - AISAPI::FetchCategoryLinks(cat_id, - [cat_id, copy, append](const LLUUID& id) - { - LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); - if (cat) - { - cat->setFetching(LLViewerInventoryCategory::FETCH_NONE); - } - if (id.isNull()) - { - LL_WARNS() << "failed to fetch category, attempting to wear as is " << cat_id << LL_ENDL; - } - LLAppearanceMgr::instance().wearCategoryFinal(cat_id, copy, append); - }); + LLInventoryModelBackgroundFetch::getInstance()->fetchFolderAndLinks( + cat_id, + [cat_id, copy, append] + { + LLAppearanceMgr::instance().wearCategoryFinal(cat_id, copy, append); + }); } else { @@ -4595,30 +4585,20 @@ protected: void callAfterCOFFetch(nullary_func_t cb) { - LLUUID cat_id = LLAppearanceMgr::instance().getCOF(); - LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); - if (AISAPI::isAvailable()) { - // Mark cof (update timer) so that background fetch won't request it - cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE); // For reliability assume that we have no relevant cache, so // fetch cof along with items cof's links point to. - AISAPI::FetchCOF([cb](const LLUUID& id) - { - cb(); - LLUUID cat_id = LLAppearanceMgr::instance().getCOF(); - LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); - if (cat) - { - cat->setFetching(LLViewerInventoryCategory::FETCH_NONE); - } - }); + LLInventoryModelBackgroundFetch::getInstance()->fetchCOF(cb); } else { LL_INFOS() << "AIS API v3 not available, using callAfterCategoryFetch" << LL_ENDL; - // startup should have marked folder as fetching, remove that + LLUUID cat_id = LLAppearanceMgr::instance().getCOF(); + LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id); + + // Special case, startup should have marked cof as FETCH_RECURSIVE + // to prevent dupplicate request, remove that cat->setFetching(LLViewerInventoryCategory::FETCH_NONE); callAfterCategoryFetch(cat_id, cb); } @@ -4640,30 +4620,16 @@ void callAfterCategoryFetch(const LLUUID& cat_id, nullary_func_t cb) void callAfterCategoryLinksFetch(const LLUUID &cat_id, nullary_func_t cb) { - LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id); if (AISAPI::isAvailable()) { - // Mark folder (update timer) so that background fetch won't request it - cat->setFetching(LLViewerInventoryCategory::FETCH_RECURSIVE); // Assume that we have no relevant cache. Fetch folder, and items folder's links point to. - AISAPI::FetchCategoryLinks(cat_id, - [cb, cat_id](const LLUUID &id) - { - cb(); - LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id); - if (cat) - { - cat->setFetching(LLViewerInventoryCategory::FETCH_NONE); - } - }); - } - else - { - LL_WARNS() << "AIS API v3 not available, can't use AISAPI::FetchCOF" << LL_ENDL; - // startup should have marked folder as fetching, remove that - cat->setFetching(LLViewerInventoryCategory::FETCH_NONE); - callAfterCategoryFetch(cat_id, cb); - } + LLInventoryModelBackgroundFetch::getInstance()->fetchFolderAndLinks(cat_id, cb); + } + else + { + LL_WARNS() << "AIS API v3 not available, can't use AISAPI::FetchCOF" << LL_ENDL; + callAfterCategoryFetch(cat_id, cb); + } } -- cgit v1.2.3