Skip to content

Commit b9f6d28

Browse files
fix race
1 parent 860ac94 commit b9f6d28

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/Ydb.Sdk/src/Ado/Session/PoolingSessionSource.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ private async ValueTask<ISession> RentAsync(CancellationToken cancellationToken)
111111
{
112112
if (!waiterTcs.TrySetResult(null))
113113
{
114-
if (waiterTcs.Task.IsCompleted && CheckIdleSession(waiterTcs.Task.Result))
114+
if (waiterTcs.Task is { IsCompleted: true, Result: not null } t)
115115
{
116-
_idleSessions.Push(waiterTcs.Task.Result);
116+
_idleSessions.Push(t.Result);
117117
}
118118

119119
WakeUpWaiter();

src/Ydb.Sdk/test/Ydb.Sdk.Ado.Benchmarks/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ Allocated : Allocated memory per single operation (managed only, incl
1717
1024B)
1818
1 ns : 1 Nanosecond (0.000000001 sec)
1919

20+
BenchmarkDotNet v0.15.1, macOS Sequoia 15.5 (24F74) [Darwin 24.5.0]
21+
Apple M2 Pro, 1 CPU, 12 logical and 12 physical cores
22+
.NET SDK 9.0.201
23+
[Host] : .NET 8.0.2 (8.0.224.6711), Arm64 RyuJIT AdvSIMD
24+
DefaultJob : .NET 8.0.2 (8.0.224.6711), Arm64 RyuJIT AdvSIMD
25+
26+
2027
# YDB .NET SDK Session Pool V1 On Semaphore-Based
2128

2229
| Method | Mean | Error | StdDev | Completed Work Items | Lock Contentions | Gen0 | Gen1 | Allocated |

0 commit comments

Comments
 (0)