From 81f2d88db362cc21c50858295d0e9d375db61f67 Mon Sep 17 00:00:00 2001 From: smizrahi Date: Wed, 11 Oct 2023 12:21:02 +0200 Subject: [PATCH] fix(core): Add cache for CDefaultsSize to avoid spamming SQL request (pgsql) --- SoObjects/SOGo/SOGoSQLUserProfile.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SoObjects/SOGo/SOGoSQLUserProfile.m b/SoObjects/SOGo/SOGoSQLUserProfile.m index 54ee5d1ed..af9608f23 100644 --- a/SoObjects/SOGo/SOGoSQLUserProfile.m +++ b/SoObjects/SOGo/SOGoSQLUserProfile.m @@ -273,9 +273,12 @@ static const NSString *kCDefaultsLenKey = @"kCDefaultsLenKey"; [cm releaseChannel: channel immediately: YES]; if (infos && [infos objectForKey:@"CHARACTER_MAXIMUM_LENGTH"]) { r = [[infos objectForKey:@"CHARACTER_MAXIMUM_LENGTH"] longLongValue]; - [cache setValue: [[NSNumber numberWithUnsignedLongLong: r] stringValue] forKey: kCDefaultsLenKey]; + } else if (infos && [infos objectForKey:@"character_maximum_length"]) { // PGSQL case + r = [[infos objectForKey:@"character_maximum_length"] longLongValue]; } } + + [cache setValue: [[NSNumber numberWithUnsignedLongLong: r] stringValue] forKey: kCDefaultsLenKey]; }