Skip to content

Commit

Permalink
Release 2.2.2 (#501)
Browse files Browse the repository at this point in the history
* Release 2.2.2

* Change ConsumerConfig AckPolicy default to Explicit (#490)
* Add support for Consumer Create Action (#497)
* Add `IsSuccess` extension method for PubAckResponse (#493)
* Watch Multiple KV Filters (#485)
* FIX : PurgeDeletesAsync hangs if KV Bucket is already empty (#489)
* Fix NUID sequence (#488)

* Fixed test
  • Loading branch information
mtmk authored May 23, 2024
1 parent 46a07b9 commit 83def9f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/NATS.Client.Core/Commands/CommandWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public ValueTask UnsubscribeAsync(int sid, int? maxMsgs, CancellationToken cance
}

// only used for internal testing
internal async Task TestStallFlushAsync(TimeSpan timeSpan)
internal async Task TestStallFlushAsync(TimeSpan timeSpan, CancellationToken cancellationToken)
{
await _semLock.WaitAsync().ConfigureAwait(false);

Expand All @@ -418,7 +418,7 @@ internal async Task TestStallFlushAsync(TimeSpan timeSpan)
await _flushTask.ConfigureAwait(false);
}

_flushTask = Task.Delay(timeSpan);
_flushTask = Task.Delay(timeSpan, cancellationToken);
}
finally
{
Expand Down
6 changes: 4 additions & 2 deletions tests/NATS.Client.Core.Tests/CancellationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class CancellationTest
[Fact]
public async Task CommandTimeoutTest()
{
var server = NatsServer.Start(_output, TransportType.Tcp);
await using var server = NatsServer.Start();

await using var conn = server.CreateClientConnection(NatsOpts.Default with { CommandTimeout = TimeSpan.FromMilliseconds(1) });
await conn.ConnectAsync();
Expand All @@ -19,7 +19,8 @@ public async Task CommandTimeoutTest()
var cancellationToken = cts.Token;

// stall the flush task
var stallTask = conn.CommandWriter.TestStallFlushAsync(TimeSpan.FromSeconds(1));
var stopToken = new CancellationTokenSource(TimeSpan.FromSeconds(10));
var stallTask = conn.CommandWriter.TestStallFlushAsync(TimeSpan.FromSeconds(10), stopToken.Token);

// commands that call ConnectAsync throw OperationCanceledException
await Assert.ThrowsAsync<OperationCanceledException>(() => conn.PingAsync(cancellationToken).AsTask());
Expand All @@ -31,6 +32,7 @@ await Assert.ThrowsAsync<OperationCanceledException>(async () =>
}
});

stopToken.Cancel();
await stallTask;
}

Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.1
2.2.2

0 comments on commit 83def9f

Please sign in to comment.