Skip to content

Commit 2944342

Browse files
fix
1 parent b33975d commit 2944342

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,11 @@ private async ValueTask<ISession> RentAsync(CancellationToken cancellationToken)
155155
if (Interlocked.CompareExchange(ref _numSessions, numSessions + 1, numSessions) != numSessions)
156156
continue;
157157

158-
if (IsDisposed)
159-
{
160-
Interlocked.Decrement(ref _numSessions);
161-
162-
break;
163-
}
164-
165158
try
166159
{
160+
if (IsDisposed)
161+
throw new YdbException("Session Source is disposed.");
162+
167163
var session = _sessionFactory.NewSession(this);
168164
await session.Open(cancellationToken);
169165

0 commit comments

Comments
 (0)