Skip to content

Commit

Permalink
Create variable for max status retry
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-lf committed Mar 22, 2024
1 parent 6ec657b commit 1d7dafb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Snowflake.Data.Tests/IntegrationTests/SFDbCommandIT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,14 @@ public async Task TestFailedAsyncExecQueryThrowsErrorAsync()
using (SnowflakeDbCommand cmd = (SnowflakeDbCommand)conn.CreateCommand())
{
// Arrange
var statusMaxRetryCount = 5;
var statusRetryCount = 0;
cmd.CommandText = $"SELECT * FROM FAKE_TABLE;";

// Act
var queryId = await cmd.ExecuteAsyncInAsyncMode(CancellationToken.None).ConfigureAwait(false);
var queryStatus = await cmd.GetQueryStatusAsync(queryId, CancellationToken.None).ConfigureAwait(false);
while (statusRetryCount < 5 && QueryStatuses.IsStillRunning(queryStatus))
while (statusRetryCount < statusMaxRetryCount && QueryStatuses.IsStillRunning(queryStatus))
{
Thread.Sleep(1000);
queryStatus = await cmd.GetQueryStatusAsync(queryId, CancellationToken.None).ConfigureAwait(false);
Expand Down Expand Up @@ -1410,12 +1411,13 @@ public void TestFailedAsyncExecQueryThrowsError()
using (SnowflakeDbCommand cmd = (SnowflakeDbCommand)conn.CreateCommand())
{
// Arrange
var statusMaxRetryCount = 5;
var statusRetryCount = 0;
cmd.CommandText = $"SELECT * FROM FAKE_TABLE;";

// Act
queryId = cmd.ExecuteInAsyncMode();
while (statusRetryCount < 5 && QueryStatuses.IsStillRunning(cmd.GetQueryStatus(queryId)))
while (statusRetryCount < statusMaxRetryCount && QueryStatuses.IsStillRunning(cmd.GetQueryStatus(queryId)))
{
Thread.Sleep(1000);
statusRetryCount++;
Expand Down

0 comments on commit 1d7dafb

Please sign in to comment.