diff --git a/projects/RabbitMQ.Client/Impl/Channel.PublisherConfirms.cs b/projects/RabbitMQ.Client/Impl/Channel.PublisherConfirms.cs index d179af7aa..dff4504d1 100644 --- a/projects/RabbitMQ.Client/Impl/Channel.PublisherConfirms.cs +++ b/projects/RabbitMQ.Client/Impl/Channel.PublisherConfirms.cs @@ -283,6 +283,11 @@ await _confirmSemaphore.WaitAsync(reason.CancellationToken) lease = await _outstandingPublisherConfirmationsRateLimiter.AcquireAsync( cancellationToken: cancellationToken) .ConfigureAwait(false); + + if (!lease.IsAcquired) + { + throw new InvalidOperationException("Could not acquire a lease from the rate limiter."); + } } }