Skip to content

Commit

Permalink
SNOW-986233 Logging pool status
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-knozderko committed Apr 29, 2024
1 parent 4f2a167 commit 0dfd9f2
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 60 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Data.Common;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -7,6 +6,7 @@
using Snowflake.Data.Client;
using Snowflake.Data.Core;
using Snowflake.Data.Core.Session;
using Snowflake.Data.Log;
using Snowflake.Data.Tests.Mock;
using Snowflake.Data.Tests.Util;

Expand All @@ -17,6 +17,7 @@ namespace Snowflake.Data.Tests.IntegrationTests
public class ConnectionMultiplePoolsAsyncIT: SFBaseTestAsync
{
private readonly PoolConfig _previousPoolConfig = new PoolConfig();
private readonly SFLogger logger = SFLoggerFactory.GetLogger<SFConnectionIT>();

[SetUp]
public new void BeforeTest()
Expand Down Expand Up @@ -65,6 +66,8 @@ public async Task TestDoNotAddToPoolInvalidConnectionAsync()

// assert
var pool = SnowflakeDbConnectionPool.GetPool(connection.ConnectionString);
var poolState = pool.GetCurrentState();
logger.Warn($"Pool state: {poolState}");
Assert.Less(pool.GetCurrentPoolSize(), SFSessionHttpClientProperties.DefaultMinPoolSize); // for invalid connection string it is used default min pool size

// cleanup
Expand Down
2 changes: 2 additions & 0 deletions Snowflake.Data/Core/Session/IWaitingQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ internal interface IWaitingQueue

bool IsAnyoneWaiting();

int WaitingCount();

bool IsWaitingEnabled();
}
}
5 changes: 5 additions & 0 deletions Snowflake.Data/Core/Session/NonWaitingQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ public bool IsAnyoneWaiting()
return false;
}

public int WaitingCount()
{
return 0;
}

public bool IsWaitingEnabled()
{
return false;
Expand Down
Loading

0 comments on commit 0dfd9f2

Please sign in to comment.