Skip to content

Commit 898c21f

Browse files
Throw when lease not acquired. This can happen then the rate limiter doesn't allow queuing or is generally wrongly configured (#1714)
Co-authored-by: danielmarbach <danielmarbach@users.noreply.github.com>
1 parent e1b62d1 commit 898c21f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

projects/RabbitMQ.Client/Impl/Channel.PublisherConfirms.cs

+5
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,11 @@ await _confirmSemaphore.WaitAsync(reason.CancellationToken)
283283
lease = await _outstandingPublisherConfirmationsRateLimiter.AcquireAsync(
284284
cancellationToken: cancellationToken)
285285
.ConfigureAwait(false);
286+
287+
if (!lease.IsAcquired)
288+
{
289+
throw new InvalidOperationException("Could not acquire a lease from the rate limiter.");
290+
}
286291
}
287292
}
288293

0 commit comments

Comments
 (0)