From 7b9817cbcc5acab58d9d4355984b429850bd3ef8 Mon Sep 17 00:00:00 2001 From: dolphin Date: Mon, 10 Mar 2014 10:15:19 -0700 Subject: Fixed a bug that lost callbacks if > 10 experiences were looked up at a time. --- indra/llmessage/llexperiencecache.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'indra/llmessage') diff --git a/indra/llmessage/llexperiencecache.cpp b/indra/llmessage/llexperiencecache.cpp index 921c1edc2e..5cca918baf 100644 --- a/indra/llmessage/llexperiencecache.cpp +++ b/indra/llmessage/llexperiencecache.cpp @@ -415,40 +415,39 @@ namespace LLExperienceCache F64 now = LLFrameTimer::getTotalSeconds(); const U32 EXP_URL_SEND_THRESHOLD = 3000; - + const U32 PAGE_SIZE = EXP_URL_SEND_THRESHOLD/UUID_STR_LENGTH; std::ostringstream ostr; ask_queue_t keys; - ostr << sLookupURL; + ostr << sLookupURL << "?page_size=" << PAGE_SIZE; - char arg='?'; int request_count = 0; - for(ask_queue_t::const_iterator it = sAskQueue.begin() ; it != sAskQueue.end() && request_count < sMaximumLookups; ++it) + while(!sAskQueue.empty() && request_count < sMaximumLookups) { + ask_queue_t::const_iterator it = sAskQueue.begin(); const LLUUID& key = it->first; const std::string& key_type = it->second; - ostr << arg << key_type << '=' << key.asString() ; + ostr << '&' << key_type << '=' << key.asString() ; keys[key]=key_type; request_count++; sPendingQueue[key] = now; - - arg='&'; - + if(ostr.tellp() > EXP_URL_SEND_THRESHOLD) { LL_DEBUGS("ExperienceCache") << "requestExperiences() query: " << ostr.str() << LL_ENDL; LLHTTPClient::get(ostr.str(), new LLExperienceResponder(keys)); ostr.clear(); ostr.str(sLookupURL); - arg='?'; + ostr << "?page_size=" << PAGE_SIZE; keys.clear(); } + sAskQueue.erase(it); } if(ostr.tellp() > sLookupURL.size()) @@ -456,8 +455,6 @@ namespace LLExperienceCache LL_DEBUGS("ExperienceCache") << "requestExperiences() query 2: " << ostr.str() << LL_ENDL; LLHTTPClient::get(ostr.str(), new LLExperienceResponder(keys)); } - - sAskQueue.clear(); } bool isRequestPending(const LLUUID& public_key) -- cgit v1.2.3