diff options
| author | Merov Linden <merov@lindenlab.com> | 2015-02-21 18:41:54 -0800 | 
|---|---|---|
| committer | Merov Linden <merov@lindenlab.com> | 2015-02-21 18:41:54 -0800 | 
| commit | 0177f56fc92536b7fe0c8139ae1e081fd09eacfe (patch) | |
| tree | 833ac429fdf8921ceb74a38f9aab195ffe06a802 | |
| parent | 9ce64ec527f7b49b1641753ce6e67b8ed7f603c7 (diff) | |
DD-335 : Improve the performance of Get listings by 400%, fix a bug when error occured on SLM
| -rwxr-xr-x | indra/newview/llinventoryfunctions.cpp | 2 | ||||
| -rwxr-xr-x | indra/newview/llmarketplacefunctions.cpp | 34 | ||||
| -rwxr-xr-x | indra/newview/llmarketplacefunctions.h | 2 | 
3 files changed, 9 insertions, 29 deletions
| diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 02c4d76a13..3939281d0a 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -274,7 +274,7 @@ void update_marketplace_category(const LLUUID& cur_uuid, bool perform_consistenc          }          // Check if the count on hand needs to be updated on SLM -        if (!LLMarketplaceData::instance().isUpdating(listing_uuid) && +        if (perform_consistency_enforcement && !LLMarketplaceData::instance().isUpdating(listing_uuid) &&              (compute_stock_count(listing_uuid) != LLMarketplaceData::instance().getCountOnHand(listing_uuid)))          {              LLMarketplaceData::instance().updateCountOnHand(listing_uuid); diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 3bedb0db44..c0823cf1de 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -257,12 +257,7 @@ public:              LLUUID version_id(version_uuid_string);              if (folder_id.notNull())              { -                LLMarketplaceData::instance().deleteListing(folder_id,false); -                LLMarketplaceData::instance().addListing(folder_id,listing_id,version_id,is_listed,false); -                LLMarketplaceData::instance().setListingURL(folder_id, edit_url,false); -                LLMarketplaceData::instance().setCountOnHand(folder_id,count,false); -                update_marketplace_category(folder_id, false); -                gInventory.notifyObservers(); +                LLMarketplaceData::instance().addListing(folder_id,listing_id,version_id,is_listed,edit_url,count);              }              it++;          } @@ -331,9 +326,7 @@ public:              LLUUID folder_id(folder_uuid_string);              LLUUID version_id(version_uuid_string); -            LLMarketplaceData::instance().addListing(folder_id,listing_id,version_id,is_listed, false); -            LLMarketplaceData::instance().setListingURL(folder_id, edit_url, false); -            LLMarketplaceData::instance().setCountOnHand(folder_id,count,false); +            LLMarketplaceData::instance().addListing(folder_id,listing_id,version_id,is_listed,edit_url,count);              update_marketplace_category(folder_id, false);              gInventory.notifyObservers();              it++; @@ -572,9 +565,7 @@ public:              }              // Add the new association -            LLMarketplaceData::instance().addListing(folder_id,listing_id,version_id,is_listed, false); -            LLMarketplaceData::instance().setListingURL(folder_id, edit_url, false); -            LLMarketplaceData::instance().setCountOnHand(folder_id,count,false); +            LLMarketplaceData::instance().addListing(folder_id,listing_id,version_id,is_listed,edit_url,count);              update_marketplace_category(folder_id, false);              gInventory.notifyObservers(); @@ -1571,31 +1562,20 @@ bool LLMarketplaceData::associateListing(const LLUUID& folder_id, const LLUUID&  }  // Methods privately called or called by SLM responders to perform changes -bool LLMarketplaceData::addListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed, bool update) +bool LLMarketplaceData::addListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed,  const std::string& edit_url, S32 count)  { -    if (isListed(folder_id)) -    { -        // Listing already exists -> exit with error -        return false; -    }  	mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id, listing_id, version_id, is_listed); - -    if (update) -    { -        update_marketplace_category(folder_id, false); -        gInventory.notifyObservers(); -    } +    mMarketplaceItems[folder_id].mEditURL = edit_url; +    mMarketplaceItems[folder_id].mCountOnHand = count;      return true;  }  bool LLMarketplaceData::deleteListing(const LLUUID& folder_id, bool update)  { -    if (!isListed(folder_id)) +	if (mMarketplaceItems.erase(folder_id) != 1)      { -        // Listing doesn't exist -> exit with error          return false;      } -	mMarketplaceItems.erase(folder_id);      if (update)      { diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index aa78cfd2d8..755643ccd0 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -230,7 +230,7 @@ public:  private:      // Modify Marketplace data set  : each method returns true if the function succeeds, false if error      // Used internally only by SLM Responders when data are received from the SLM Server -    bool addListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed, bool update = true); +    bool addListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed, const std::string& edit_url, S32 count);      bool deleteListing(const LLUUID& folder_id, bool update = true);      bool setListingID(const LLUUID& folder_id, S32 listing_id, bool update = true);      bool setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id, bool update = true); | 
