Skip to content

Commit 6c5dc62

Browse files
committed
Allow changing common connection pooling settings
For tweaking performance of large batch jobs.
1 parent 46c7036 commit 6c5dc62

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

osu.Server.QueueProcessor/DatabaseAccess.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ public static MySqlConnection GetConnection()
2525
string user = (Environment.GetEnvironmentVariable("DB_USER") ?? "root");
2626
string password = (Environment.GetEnvironmentVariable("DB_PASS") ?? string.Empty);
2727
string name = (Environment.GetEnvironmentVariable("DB_NAME") ?? "osu");
28+
bool pooling = Environment.GetEnvironmentVariable("DB_POOLING") != Boolean.FalseString && Environment.GetEnvironmentVariable("DB_POOLING") != "0";
29+
int maxPoolSize = int.Parse(Environment.GetEnvironmentVariable("DB_MAX_POOL_SIZE") ?? "100");
2830

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

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

3436
var connection = new MySqlConnection(connectionString);

0 commit comments

Comments
 (0)