Apr 29, 2020
Aug 11, 2020
CMS Core
Closed, Fixed and tested
Hi Support,
I have a product issue to report that exists in the DefaultContentLanguageSettingsHandler.GetContentLanguageSetting method. This is being identified using the Briscoe client.
The current method uses a local within a lambda and this causes a function to be allocated for every execution and, given the hit count of this method, that’s a lot of memory (just a little shy of 1GB within 130 seconds).
So, in this particular case it’s better to iterate through the enumerable.
private static ContentLanguageSetting GetContentLanguageSetting(IEnumerable<ContentLanguageSetting> languageSettings, string languageBranch)
{
foreach (var languageSetting in languageSettings)
{
if (string.Equals(languageSetting.LanguageBranch, languageBranch, StringComparison.OrdinalIgnoreCase))
{ return languageSetting; }}
return null;
}
The above code is the fix.
* Please see Zendesk Support tab for further comments and attachments.
Note for QA: To verify this we should make sure LanguageSettings (fallback/replacement) still work work as previously.