Skip to content

Commit 83def9f

Browse files
authored
Release 2.2.2 (#501)
* 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
1 parent 46a07b9 commit 83def9f

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/NATS.Client.Core/Commands/CommandWriter.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ public ValueTask UnsubscribeAsync(int sid, int? maxMsgs, CancellationToken cance
407407
}
408408

409409
// only used for internal testing
410-
internal async Task TestStallFlushAsync(TimeSpan timeSpan)
410+
internal async Task TestStallFlushAsync(TimeSpan timeSpan, CancellationToken cancellationToken)
411411
{
412412
await _semLock.WaitAsync().ConfigureAwait(false);
413413

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

421-
_flushTask = Task.Delay(timeSpan);
421+
_flushTask = Task.Delay(timeSpan, cancellationToken);
422422
}
423423
finally
424424
{

tests/NATS.Client.Core.Tests/CancellationTest.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class CancellationTest
1010
[Fact]
1111
public async Task CommandTimeoutTest()
1212
{
13-
var server = NatsServer.Start(_output, TransportType.Tcp);
13+
await using var server = NatsServer.Start();
1414

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

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

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

35+
stopToken.Cancel();
3436
await stallTask;
3537
}
3638

version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.2.1
1+
2.2.2

0 commit comments

Comments
 (0)