From 2c032953ac723ce7491909e4438dac5f16de9938 Mon Sep 17 00:00:00 2001 From: Luke Bakken Date: Thu, 26 Sep 2024 20:56:53 -0700 Subject: [PATCH] * Allow cancellation of final await for publisher confirmation in `BasicPublishAsync` * Fix `dotnet format` verification error --- projects/RabbitMQ.Client/Impl/ChannelBase.cs | 6 ++---- projects/Test/Integration/TestAsyncConsumer.cs | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/projects/RabbitMQ.Client/Impl/ChannelBase.cs b/projects/RabbitMQ.Client/Impl/ChannelBase.cs index e0f36f44f..4a2a80805 100644 --- a/projects/RabbitMQ.Client/Impl/ChannelBase.cs +++ b/projects/RabbitMQ.Client/Impl/ChannelBase.cs @@ -1070,8 +1070,7 @@ await _confirmSemaphore.WaitAsync(cancellationToken) if (publisherConfirmationTcs is not null) { - // TODO timeout? - await publisherConfirmationTcs.Task + await publisherConfirmationTcs.Task.WaitAsync(cancellationToken) .ConfigureAwait(false); } } @@ -1168,8 +1167,7 @@ await _confirmSemaphore.WaitAsync(cancellationToken) if (publisherConfirmationTcs is not null) { - // TODO timeout? - await publisherConfirmationTcs.Task + await publisherConfirmationTcs.Task.WaitAsync(cancellationToken) .ConfigureAwait(false); } } diff --git a/projects/Test/Integration/TestAsyncConsumer.cs b/projects/Test/Integration/TestAsyncConsumer.cs index 382c929fa..773238ff6 100644 --- a/projects/Test/Integration/TestAsyncConsumer.cs +++ b/projects/Test/Integration/TestAsyncConsumer.cs @@ -708,7 +708,7 @@ private async Task ValidateConsumerDispatchConcurrency() Assert.Equal(ConsumerDispatchConcurrency, autorecoveringChannel.ConsumerDispatcher.Concurrency); Assert.Equal(_consumerDispatchConcurrency, autorecoveringChannel.ConsumerDispatcher.Concurrency); await using IChannel ch = await _conn.CreateChannelAsync( - new CreateChannelOptions { ConsumerDispatchConcurrency = expectedConsumerDispatchConcurrency}); + new CreateChannelOptions { ConsumerDispatchConcurrency = expectedConsumerDispatchConcurrency }); AutorecoveringChannel ach = (AutorecoveringChannel)ch; Assert.Equal(expectedConsumerDispatchConcurrency, ach.ConsumerDispatcher.Concurrency); }