summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-11-28 21:42:13 +0200
committerakleshchev <117672381+akleshchev@users.noreply.github.com>2023-12-06 01:02:42 +0200
commitf394d675a766f58b62bebaaa4f7caeddcec9a600 (patch)
tree2264ded54b5f2a0b7d524a6deeb4e3d4f43c3a6a /indra
parentf4307bed264cc4c5502e8f0552cbf368e23edc28 (diff)
SL-20181 Dupplicate prevention for forced fetches
Might be better to have a separate set of states for 'fetched children' or 'all children complete' inside the folder itself.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.cpp44
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.h1
2 files changed, 39 insertions, 6 deletions
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index 91adef8047..f1c5104e76 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -358,8 +358,22 @@ void LLInventoryModelBackgroundFetch::scheduleFolderFetch(const LLUUID& cat_id,
{
mBackgroundFetchActive = true;
- // Specific folder requests go to front of queue.
- mFetchFolderQueue.push_front(FetchQueueInfo(cat_id, forced ? FT_FORCED : FT_DEFAULT));
+ if (forced)
+ {
+ // check if already requested
+ if (mForceFetchSet.find(cat_id) != mForceFetchSet.end())
+ {
+ mForceFetchSet.insert(cat_id);
+ mFetchItemQueue.push_front(FetchQueueInfo(cat_id, FT_FORCED));
+ }
+ }
+ else
+ {
+ // Specific folder requests go to front of queue.
+ // version presence acts as dupplicate prevention for normal fetches
+ mFetchItemQueue.push_front(FetchQueueInfo(cat_id, FT_DEFAULT));
+ }
+
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
}
}
@@ -369,8 +383,21 @@ void LLInventoryModelBackgroundFetch::scheduleItemFetch(const LLUUID& item_id, b
if (mFetchItemQueue.empty() || mFetchItemQueue.front().mUUID != item_id)
{
mBackgroundFetchActive = true;
+ if (forced)
+ {
+ // check if already requested
+ if (mForceFetchSet.find(item_id)!= mForceFetchSet.end())
+ {
+ mForceFetchSet.insert(item_id);
+ mFetchItemQueue.push_front(FetchQueueInfo(item_id, FT_FORCED, false));
+ }
+ }
+ else
+ {
+ // 'isFinished' being set acts as dupplicate prevention for normal fetches
+ mFetchItemQueue.push_front(FetchQueueInfo(item_id, FT_DEFAULT, false));
+ }
- mFetchItemQueue.push_front(FetchQueueInfo(item_id, forced ? FT_FORCED : FT_DEFAULT, false));
gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
}
}
@@ -846,10 +873,10 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc
mExpectedFolderIds.push_back(cat_id);
EFetchType type = fetch_info.mFetchType;
- LLUUID cat_id = cat->getUUID();
- AISAPI::completion_t cb = [cat_id , type](const LLUUID& response_id)
+ LLUUID cat_cb_id = cat_id;
+ AISAPI::completion_t cb = [cat_cb_id, type](const LLUUID& response_id)
{
- LLInventoryModelBackgroundFetch::instance().onAISFolderCalback(cat_id , response_id , type);
+ LLInventoryModelBackgroundFetch::instance().onAISFolderCalback(cat_cb_id, response_id , type);
};
AISAPI::ITEM_TYPE item_type = AISAPI::INVENTORY;
@@ -908,6 +935,11 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc
AISAPI::FetchItem(fetch_info.mUUID, AISAPI::INVENTORY, ais_simple_item_callback);
}
}
+
+ if (fetch_info.mFetchType == FT_FORCED)
+ {
+ mForceFetchSet.erase(fetch_info.mUUID);
+ }
}
// Bundle up a bunch of requests to send all at once.
diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h
index e7be265a3d..5d66985b40 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.h
+++ b/indra/newview/llinventorymodelbackgroundfetch.h
@@ -129,6 +129,7 @@ private:
F32 mMinTimeBetweenFetches;
fetch_queue_t mFetchFolderQueue;
fetch_queue_t mFetchItemQueue;
+ uuid_set_t mForceFetchSet;
std::list<LLUUID> mExpectedFolderIds; // for debug, should this track time?
};