From 8e1c46d8e09a121d9c7f75bb426a8a6600c3f075 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 10 Oct 2015 20:46:02 +0200 Subject: [PATCH] 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. --- indra/llmessage/llavatarnamecache.cpp | 54 ++++++++++++++++++++----- indra/newview/app_settings/settings.xml | 11 +++++ 2 files changed, 54 insertions(+), 11 deletions(-) diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index 31a2f57fd0..bca7d9c0bc 100755 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -39,6 +39,7 @@ #include #include #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)) + // 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 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; + } } + // } bool LLAvatarNameCache::expirationFromCacheControl(const LLSD& headers, F64 *expires) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index eeaf23f300..049d3163af 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -23687,6 +23687,17 @@ Change of this parameter will affect the layout of buttons in notification toast Value 0 + FSLegacyNameCacheExpiration + + Comment + Use the legacy avatar name cache expiration (expiration at least 60 mins.) + Persist + 1 + Type + Boolean + Value + 0 +