Skip to content

Commit 4df6ff7

Browse files
fix double dispose
1 parent 780dd4b commit 4df6ff7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Ydb.Sdk/src/Ado/PoolManager.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,18 @@ CancellationToken cancellationToken
5050

5151
internal static async Task ClearPool(string connectionString)
5252
{
53-
try
53+
if (Pools.TryRemove(connectionString, out var sessionPool))
5454
{
55-
await SemaphoreSlim.WaitAsync();
56-
57-
if (Pools.Remove(connectionString, out var sessionPool))
55+
try
5856
{
57+
await SemaphoreSlim.WaitAsync();
58+
5959
await sessionPool.DisposeAsync();
6060
}
61-
}
62-
finally
63-
{
64-
SemaphoreSlim.Release();
61+
finally
62+
{
63+
SemaphoreSlim.Release();
64+
}
6565
}
6666
}
6767

0 commit comments

Comments
 (0)