Set the avatar name expiration period via LL's method instead of applying a minimum expiration of 60 minutes

A minimum expiration of 60 minutes for an avatar name appears to be way too long
as the default expiration time returned by the region is 2 minutes. This means
people will see an outdated name 30 times longer than it should be.

Since this might expose an additional load to the region it can't handle due
to the previous less frequent name requests, the debug setting "FSLegacyNameCacheExpiration"
has been added to revert to our legacy behavior as instant "fix" in case this
will cause serious issues.
meow-7.2.2
Ansariel 2015-10-10 20:46:02 +02:00
parent 76ae36c781
commit 8e1c46d8e0
2 changed files with 54 additions and 11 deletions

View File

@ -39,6 +39,7 @@
#include <map>
#include <set>
#include "../newview/lggcontactsets.h"
#include "../llxml/llcontrol.h"
namespace LLAvatarNameCache
{
@ -762,22 +763,53 @@ void LLAvatarNameCache::insert(const LLUUID& agent_id, const LLAvatarName& av_na
F64 LLAvatarNameCache::nameExpirationFromHeaders(const LLSD& headers)
{
const F64 DEFAULT_EXPIRES = 60.0 * 60.0 + LLFrameTimer::getTotalSeconds();
F64 expires = 0.0;
if (expirationFromCacheControl(headers, &expires))
// <FS:Ansariel> Optional legacy name cache expiration in case SL can't handle us... ;)
//F64 expires = 0.0;
//if (expirationFromCacheControl(headers, &expires))
//{
// return expires;
//}
//else
//{
// // With no expiration info, default to an hour
// const F64 DEFAULT_EXPIRES = 60.0 * 60.0;
// F64 now = LLFrameTimer::getTotalSeconds();
// return now + DEFAULT_EXPIRES;
//}
static LLCachedControl<bool> use_legacy_namecache_expiration(*LLControlGroup::getInstance("Global"), "FSLegacyNameCacheExpiration");
if (!use_legacy_namecache_expiration)
{
//AO make sure cache expiration is at least 1HR
if (expires < DEFAULT_EXPIRES) {expires = DEFAULT_EXPIRES;}
return expires;
F64 expires = 0.0;
if (expirationFromCacheControl(headers, &expires))
{
return expires;
}
else
{
// With no expiration info, default to an hour
const F64 DEFAULT_EXPIRES = 60.0 * 60.0;
F64 now = LLFrameTimer::getTotalSeconds();
return now + DEFAULT_EXPIRES;
}
}
else
{
// With no expiration info, default to an hour
//F64 now = LLFrameTimer::getTotalSeconds();
//return now + DEFAULT_EXPIRES;
return DEFAULT_EXPIRES;
const F64 DEFAULT_EXPIRES = 60.0 * 60.0 + LLFrameTimer::getTotalSeconds();
F64 expires = 0.0;
if (expirationFromCacheControl(headers, &expires))
{
//AO make sure cache expiration is at least 1HR
if (expires < DEFAULT_EXPIRES) {expires = DEFAULT_EXPIRES;}
return expires;
}
else
{
return DEFAULT_EXPIRES;
}
}
// </FS:Ansariel>
}
bool LLAvatarNameCache::expirationFromCacheControl(const LLSD& headers, F64 *expires)

View File

@ -23687,6 +23687,17 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>0</integer>
</map>
<key>FSLegacyNameCacheExpiration</key>
<map>
<key>Comment</key>
<string>Use the legacy avatar name cache expiration (expiration at least 60 mins.)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
</map>
</llsd>