Skip to content

Commit

Permalink
SNOW-817091: Fix session closing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-lf committed Mar 9, 2024
1 parent 812cba0 commit 3810211
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Snowflake.Data/Client/SnowflakeDbConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ public override void Close()
{
var transactionRollbackStatus = SnowflakeDbConnectionPool.GetPooling() ? TerminateTransactionForDirtyConnectionReturningToPool() : TransactionRollbackStatus.Undefined;

if (CanReuseSession(transactionRollbackStatus) &&
SfSession.StillRunningAsyncQueries() &&
if ((CanReuseSession(transactionRollbackStatus) ||
SfSession.StillRunningAsyncQueries()) &&
SnowflakeDbConnectionPool.AddSession(SfSession)
)
{
Expand Down Expand Up @@ -194,8 +194,8 @@ public virtual async Task CloseAsync(CancellationToken cancellationToken)
{
var transactionRollbackStatus = SnowflakeDbConnectionPool.GetPooling() ? TerminateTransactionForDirtyConnectionReturningToPool() : TransactionRollbackStatus.Undefined;

if (CanReuseSession(transactionRollbackStatus) &&
await SfSession.StillRunningAsyncQueriesAsync(cancellationToken).ConfigureAwait(false) &&
if ((CanReuseSession(transactionRollbackStatus) ||
await SfSession.StillRunningAsyncQueriesAsync(cancellationToken).ConfigureAwait(false)) &&
SnowflakeDbConnectionPool.AddSession(SfSession))
{
logger.Debug($"Session pooled: {SfSession.sessionId}");
Expand Down

0 comments on commit 3810211

Please sign in to comment.