Skip to content

Commit

Permalink
Merge pull request #32 from peppy/allow-pool-adjust
Browse files Browse the repository at this point in the history
Allow changing common connection pooling settings
  • Loading branch information
smoogipoo authored Oct 31, 2024
2 parents 46c7036 + 82c4472 commit 5280840
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions osu.Server.QueueProcessor.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,7 @@ See the LICENCE file in the repository root for full licence text.
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002EMemberReordering_002EMigrations_002ECSharpFileLayoutPatternRemoveIsAttributeUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
Expand Down
5 changes: 4 additions & 1 deletion osu.Server.QueueProcessor/DatabaseAccess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ public static MySqlConnection GetConnection()
string user = (Environment.GetEnvironmentVariable("DB_USER") ?? "root");
string password = (Environment.GetEnvironmentVariable("DB_PASS") ?? string.Empty);
string name = (Environment.GetEnvironmentVariable("DB_NAME") ?? "osu");
bool pooling = string.Equals(Environment.GetEnvironmentVariable("DB_POOLING"), Boolean.FalseString, StringComparison.InvariantCultureIgnoreCase)
&& Environment.GetEnvironmentVariable("DB_POOLING") != "0";
int maxPoolSize = int.Parse(Environment.GetEnvironmentVariable("DB_MAX_POOL_SIZE") ?? "100");

string passwordString = string.IsNullOrEmpty(password) ? string.Empty : $"Password={password};";

connectionString = $"Server={host};Port={port};Database={name};User ID={user};{passwordString}ConnectionTimeout=5;ConnectionReset=false;Pooling=true;";
connectionString = $"Server={host};Port={port};Database={name};User ID={user};{passwordString}ConnectionTimeout=5;ConnectionReset=false;Pooling={pooling};Max Pool Size={maxPoolSize};";
}

var connection = new MySqlConnection(connectionString);
Expand Down

0 comments on commit 5280840

Please sign in to comment.