SL-20181 Minor inventory fetching adjustements

meow-7.2.2
Andrey Kleshchev 2023-11-28 23:27:18 +02:00 committed by akleshchev
parent f394d675a7
commit 9f3edb90d4
6 changed files with 36 additions and 21 deletions

View File

@ -1738,10 +1738,6 @@ void AISUpdate::doUpdate()
LL_DEBUGS("Inventory") << "cat version update " << cat->getName() << " to version " << cat->getVersion() << LL_ENDL;
if (cat->getVersion() != version)
{
LL_WARNS() << "Possible version mismatch for category " << cat->getName()
<< ", viewer version " << cat->getVersion()
<< " AIS version " << version << " !!!Adjusting local version!!!" << LL_ENDL;
// the AIS version should be considered the true version. Adjust
// our local category model to reflect this version number. Otherwise
// it becomes possible to get stuck with the viewer being out of
@ -1751,13 +1747,23 @@ void AISUpdate::doUpdate()
// is performed. This occasionally gets out of sync however.
if (version != LLViewerInventoryCategory::VERSION_UNKNOWN)
{
LL_WARNS() << "Possible version mismatch for category " << cat->getName()
<< ", viewer version " << cat->getVersion()
<< " AIS version " << version << " !!!Adjusting local version!!!" << LL_ENDL;
cat->setVersion(version);
}
else
{
// We do not account for update if version is UNKNOWN, so we shouldn't rise version
// either or viewer will get stuck on descendants count -1, try to refetch folder instead
cat->fetch();
//
// Todo: proper backoff?
LL_WARNS() << "Possible version mismatch for category " << cat->getName()
<< ", viewer version " << cat->getVersion()
<< " AIS version " << version << " !!!Rerequesting category!!!" << LL_ENDL;
const S32 LONG_EXPIRY = 360;
cat->fetch(LONG_EXPIRY);
}
}
}

View File

@ -202,11 +202,17 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const
&& !LLInventoryModelBackgroundFetch::instance().inventoryFetchInProgress())
{
LLViewerInventoryCategory* cat = gInventory.getCategory(folder_id);
if ((!cat && folder_id.notNull()) || (cat && cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN))
if ((!cat && folder_id.notNull()))
{
// Shouldn't happen? Server provides full list of folders on startup
LLInventoryModelBackgroundFetch::instance().start(folder_id, false);
}
else if (cat && cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN)
{
// At the moment background fetch only cares about VERSION_UNKNOWN,
// so do not check isCategoryComplete that compares descendant count
LLInventoryModelBackgroundFetch::instance().start(folder_id, false);
// so do not check isCategoryComplete that compares descendant count,
// but if that is nesesary, do a forced scheduleFolderFetch.
cat->fetch();
}
}

View File

@ -2386,7 +2386,7 @@ BOOL LLInventoryGallery::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
return handled;
}
void LLInventoryGallery::startDrag()
void LLInventoryGallery::startDrag()
{
std::vector<EDragAndDropType> types;
uuid_vec_t ids;

View File

@ -3911,19 +3911,22 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**)
for (cat_array_t::iterator cit = folders.begin(); cit != folders.end(); ++cit)
{
gInventory.updateCategory(*cit);
// Temporary workaround: just fetch the item using AIS to get missing fields.
// If this works fine we might want to extract ids only from the message
// then use AIS as a primary fetcher
LLInventoryModelBackgroundFetch::instance().scheduleFolderFetch((*cit)->getUUID(), true /*force, since it has changes*/);
gInventory.updateCategory(*cit);
if ((*cit)->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN)
{
// Temporary workaround: just fetch the item using AIS to get missing fields.
// If this works fine we might want to extract 'ids only' from the message
// then use AIS as a primary fetcher
LLInventoryModelBackgroundFetch::instance().scheduleFolderFetch((*cit)->getUUID(), true /*force, since it has changes*/);
}
// else already called fetch() above
}
for (item_array_t::iterator iit = items.begin(); iit != items.end(); ++iit)
{
gInventory.updateItem(*iit);
// Temporary workaround: just fetch the item using AIS to get missing fields.
// If this works fine we might want to extract ids only from the message
// If this works fine we might want to extract 'ids only' from the message
// then use AIS as a primary fetcher
LLInventoryModelBackgroundFetch::instance().scheduleItemFetch((*iit)->getUUID(), true);
}

View File

@ -648,15 +648,14 @@ void LLViewerInventoryCategory::setVersion(S32 version)
mVersion = version;
}
bool LLViewerInventoryCategory::fetch()
bool LLViewerInventoryCategory::fetch(S32 expiry_seconds)
{
if((VERSION_UNKNOWN == getVersion())
&& mDescendentsRequested.hasExpired()) //Expired check prevents multiple downloads.
{
LL_DEBUGS(LOG_INV) << "Fetching category children: " << mName << ", UUID: " << mUUID << LL_ENDL;
const F32 FETCH_TIMER_EXPIRY = 10.0f;
mDescendentsRequested.reset();
mDescendentsRequested.setTimerExpirySec(FETCH_TIMER_EXPIRY);
mDescendentsRequested.setTimerExpirySec(expiry_seconds);
std::string url;
if (gAgent.getRegion())

View File

@ -209,8 +209,9 @@ public:
S32 getVersion() const;
void setVersion(S32 version);
// Returns true if a fetch was issued (not nessesary in progress).
bool fetch();
// Returns true if a fetch was issued (not nessesary in progress).
// no requests will happen during expiry_seconds even if fetch completed
bool fetch(S32 expiry_seconds = 10);
typedef enum {
FETCH_NONE = 0,