Skip to content

Commit db63a55

Browse files
Merge pull request #1015 from ricado-group/fixAsyncConsumerSemaphoreDispose
Fix Semaphore Disposed Exception in AsyncConsumerWorkService (cherry picked from commit cff0c3d)
1 parent 70b943a commit db63a55

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

projects/RabbitMQ.Client/client/impl/AsyncConsumerWorkService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ private async Task LoopWithConcurrency(CancellationToken cancellationToken)
128128
{
129129
while (await _channel.Reader.WaitToReadAsync(cancellationToken).ConfigureAwait(false))
130130
{
131-
while (_channel.Reader.TryRead(out Work work))
131+
while (_channel.Reader.TryRead(out Work work) && !cancellationToken.IsCancellationRequested)
132132
{
133133
// Do a quick synchronous check before we resort to async/await with the state-machine overhead.
134134
if (!_limiter.Wait(0))

0 commit comments

Comments
 (0)