Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions MySQL.Data/src/MySqlPoolManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace MySql.Data.MySqlClient
/// </summary>
internal class MySqlPoolManager
{
private static readonly Dictionary<string, MySqlPool> Pools = new Dictionary<string, MySqlPool>();
private static readonly ConcurrentDictionary<string, MySqlPool> Pools = new ConcurrentDictionary<string, MySqlPool>();
private static readonly List<MySqlPool> ClearingPools = new List<MySqlPool>();
internal const int DEMOTED_TIMEOUT = 120000;

Expand Down Expand Up @@ -146,7 +146,7 @@ public static async Task<MySqlPool> GetPoolAsync(MySqlConnectionStringBuilder se
if (pool == null)
{
pool = await MySqlPool.CreateMySqlPoolAsync(settings, execAsync, cancellationToken).ConfigureAwait(false);
Pools.Add(text, pool);
Pools.TryAdd(text, pool);
}
else
pool.Settings = settings;
Expand Down Expand Up @@ -207,7 +207,7 @@ private static async Task ClearPoolByTextAsync(string key, bool execAsync)
await pool.ClearAsync(execAsync).ConfigureAwait(false);

// and then remove the pool from the active pools list
Pools.Remove(key);
Pools.TryRemove(key, out MySqlPool mySqlPool);

semaphoreSlim.Release();
}
Expand Down