From d3d0728bac31099785fea1bf87f11b7c29d2425d Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 18 Mar 2025 19:29:30 +0200 Subject: #3547 Further reduce ParcelInfoRequest calls --- indra/newview/llpanelprofilepicks.cpp | 4 ++-- indra/newview/llremoteparcelrequest.cpp | 19 ++++++++++++++++++- indra/newview/llremoteparcelrequest.h | 2 ++ 3 files changed, 22 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelprofilepicks.cpp b/indra/newview/llpanelprofilepicks.cpp index 09b8011ce4..a87ef4f0f9 100644 --- a/indra/newview/llpanelprofilepicks.cpp +++ b/indra/newview/llpanelprofilepicks.cpp @@ -55,7 +55,7 @@ static LLPanelInjector t_panel_profile_picks("panel_profile_picks"); static LLPanelInjector t_panel_profile_pick("panel_profile_pick"); -constexpr F32 REQUEST_TIMOUT = 60; +constexpr F32 REQUEST_TIMEOUT = 60; constexpr F32 LOCATION_CACHE_TIMOUT = 900; class LLPickHandler : public LLCommandHandler @@ -842,7 +842,7 @@ std::string LLPanelProfilePick::getLocationNotice() void LLPanelProfilePick::sendParcelInfoRequest() { - if (mParcelId != mRequestedId || mLastRequestTimer.getElapsedTimeF32() > REQUEST_TIMOUT) + if (mParcelId != mRequestedId || mLastRequestTimer.getElapsedTimeF32() > REQUEST_TIMEOUT) { if (mRequestedId.notNull()) { diff --git a/indra/newview/llremoteparcelrequest.cpp b/indra/newview/llremoteparcelrequest.cpp index 7b80e8c27f..d0aa1af2f3 100644 --- a/indra/newview/llremoteparcelrequest.cpp +++ b/indra/newview/llremoteparcelrequest.cpp @@ -102,7 +102,15 @@ void LLRemoteParcelInfoProcessor::processParcelInfoReply(LLMessageSystem* msg, v msg->getS32 ("Data", "SalePrice", parcel_data.sale_price); msg->getS32 ("Data", "AuctionID", parcel_data.auction_id); - LLRemoteParcelInfoProcessor::observer_multimap_t & observers = LLRemoteParcelInfoProcessor::getInstance()->mObservers; + LLRemoteParcelInfoProcessor* inst = LLRemoteParcelInfoProcessor::getInstance(); + + requests_map_t::const_iterator found = inst->mPendingParcelRequests.find(parcel_data.parcel_id); + if (found != inst->mPendingParcelRequests.end()) + { + inst->mPendingParcelRequests.erase(found); + } + + LLRemoteParcelInfoProcessor::observer_multimap_t & observers = inst->mObservers; typedef std::vector deadlist_t; deadlist_t dead_iters; @@ -151,6 +159,15 @@ void LLRemoteParcelInfoProcessor::processParcelInfoReply(LLMessageSystem* msg, v void LLRemoteParcelInfoProcessor::sendParcelInfoRequest(const LLUUID& parcel_id) { + constexpr F32 DUPPLICATE_TIMEOUT = 0.5f; + requests_map_t::const_iterator found = mPendingParcelRequests.find(parcel_id); + if (found != mPendingParcelRequests.end() && found->second.getElapsedTimeF32() < DUPPLICATE_TIMEOUT) + { + // recently requested + return; + } + mPendingParcelRequests[parcel_id].reset(); + LLMessageSystem *msg = gMessageSystem; msg->newMessage("ParcelInfoRequest"); diff --git a/indra/newview/llremoteparcelrequest.h b/indra/newview/llremoteparcelrequest.h index 1420b4032e..7059e14bec 100644 --- a/indra/newview/llremoteparcelrequest.h +++ b/indra/newview/llremoteparcelrequest.h @@ -91,6 +91,8 @@ public: private: typedef std::multimap > observer_multimap_t; observer_multimap_t mObservers; + typedef std::map requests_map_t; + requests_map_t mPendingParcelRequests; // Dupplicate request avoidance void regionParcelInfoCoro(std::string url, LLUUID regionId, LLVector3 posRegion, LLVector3d posGlobal, LLHandle observerHandle); }; -- cgit v1.2.3