Skip to content
Snippets Groups Projects
Commit b5aea2d0 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Improve performance of experience cache

parent 9e64b09f
No related branches found
No related tags found
2 merge requests!3Update to main branch,!2Rebase onto current main branch
...@@ -268,22 +268,22 @@ void LLExperienceCache::requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdap ...@@ -268,22 +268,22 @@ void LLExperienceCache::requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdap
LLSD headers = httpResults[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS]; LLSD headers = httpResults[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS];
// build dummy entries for the failed requests // build dummy entries for the failed requests
for (RequestQueue_t::const_iterator it = requests.begin(); it != requests.end(); ++it) for (const LLUUID& exp_id : requests)
{ {
LLSD exp = get(*it); LLSD exp = get(exp_id);
//leave the properties alone if we already have a cache entry for this xp //leave the properties alone if we already have a cache entry for this xp
if (exp.isUndefined()) if (exp.isUndefined())
{ {
exp[PROPERTIES] = PROPERTY_INVALID; exp[PROPERTIES] = PROPERTY_INVALID;
} }
exp[EXPIRES] = now + LLExperienceCacheImpl::getErrorRetryDeltaTime(status, headers); exp[EXPIRES] = now + LLExperienceCacheImpl::getErrorRetryDeltaTime(status, headers);
exp[EXPERIENCE_ID] = *it; exp[EXPERIENCE_ID] = exp_id;
exp["key_type"] = EXPERIENCE_ID; exp["key_type"] = EXPERIENCE_ID;
exp["uuid"] = *it; exp["uuid"] = exp_id;
exp["error"] = (LLSD::Integer)status.getType(); exp["error"] = (LLSD::Integer)status.getType();
exp[QUOTA] = DEFAULT_QUOTA; exp[QUOTA] = DEFAULT_QUOTA;
processExperience(*it, exp); processExperience(exp_id, exp);
} }
return; return;
} }
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#include <boost/signals2.hpp> #include <boost/signals2.hpp>
#include <boost/function.hpp> #include <boost/function.hpp>
#include "boost/unordered_map.hpp"
class LLSD; class LLSD;
class LLUUID; class LLUUID;
...@@ -116,11 +118,11 @@ class LLExperienceCache final : public LLParamSingleton < LLExperienceCache > ...@@ -116,11 +118,11 @@ class LLExperienceCache final : public LLParamSingleton < LLExperienceCache >
// May have multiple callbacks for a single ID, which are // May have multiple callbacks for a single ID, which are
// represented as multiple slots bound to the signal. // represented as multiple slots bound to the signal.
// Avoid copying signals via pointers. // Avoid copying signals via pointers.
typedef std::map<LLUUID, signal_ptr> signal_map_t; typedef boost::unordered_map<LLUUID, signal_ptr> signal_map_t;
typedef std::map<LLUUID, LLSD> cache_t; typedef boost::unordered_map<LLUUID, LLSD> cache_t;
typedef std::set<LLUUID> RequestQueue_t; typedef std::set<LLUUID> RequestQueue_t;
typedef std::map<LLUUID, F64> PendingQueue_t; typedef boost::unordered_map<LLUUID, F64> PendingQueue_t;
//-------------------------------------------- //--------------------------------------------
static const std::string PRIVATE_KEY; // "private_id" static const std::string PRIVATE_KEY; // "private_id"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment