From 35f61d538763bd6406383a95f2d5c4e89a5c7105 Mon Sep 17 00:00:00 2001 From: rootdarkarchon Date: Wed, 18 Jan 2023 11:11:59 +0100 Subject: [PATCH] add configurable redis pool and allow redis timeout --- MareSynchronosServer/MareSynchronosServer/Startup.cs | 5 +++-- .../MareSynchronosShared/Utils/ServerConfiguration.cs | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/MareSynchronosServer/MareSynchronosServer/Startup.cs b/MareSynchronosServer/MareSynchronosServer/Startup.cs index bb31454..db7b209 100644 --- a/MareSynchronosServer/MareSynchronosServer/Startup.cs +++ b/MareSynchronosServer/MareSynchronosServer/Startup.cs @@ -124,7 +124,7 @@ public class Startup new RedisHost(){ Host = address, Port = port }, }, AllowAdmin = true, - ConnectTimeout = 3000, + ConnectTimeout = options.ConnectTimeout, Database = 0, Ssl = false, Password = options.Password, @@ -135,7 +135,8 @@ public class Startup UnreachableServerAction = ServerEnumerationStrategy.UnreachableServerActionOptions.Throw, }, MaxValueLength = 1024, - PoolSize = 50, + PoolSize = mareConfig.GetValue(nameof(ServerConfiguration.RedisPool), 50), + SyncTimeout = options.SyncTimeout, }; services.AddStackExchangeRedisExtensions(redisConfiguration); diff --git a/MareSynchronosServer/MareSynchronosShared/Utils/ServerConfiguration.cs b/MareSynchronosServer/MareSynchronosShared/Utils/ServerConfiguration.cs index 4ca0e43..5a91b2c 100644 --- a/MareSynchronosServer/MareSynchronosShared/Utils/ServerConfiguration.cs +++ b/MareSynchronosServer/MareSynchronosShared/Utils/ServerConfiguration.cs @@ -5,6 +5,7 @@ namespace MareSynchronosShared.Utils; public class ServerConfiguration : MareConfigurationAuthBase { public string RedisConnectionString { get; set; } = string.Empty; + public int RedisPool { get; set; } = 50; [RemoteConfiguration] public Uri CdnFullUrl { get; set; } = null; @@ -32,6 +33,7 @@ public class ServerConfiguration : MareConfigurationAuthBase sb.AppendLine($"{nameof(CdnShardConfiguration)} => {string.Join(", ", CdnShardConfiguration.Select(c => c.ToString()))}"); sb.AppendLine($"{nameof(StaticFileServiceAddress)} => {StaticFileServiceAddress}"); sb.AppendLine($"{nameof(RedisConnectionString)} => {RedisConnectionString}"); + sb.AppendLine($"{nameof(RedisPool)} => {RedisPool}"); sb.AppendLine($"{nameof(MaxExistingGroupsByUser)} => {MaxExistingGroupsByUser}"); sb.AppendLine($"{nameof(MaxJoinedGroupsByUser)} => {MaxJoinedGroupsByUser}"); sb.AppendLine($"{nameof(MaxGroupUserCount)} => {MaxGroupUserCount}");