diff --git a/projects/RabbitMQ.Client/client/impl/AsyncConsumerWorkService.cs b/projects/RabbitMQ.Client/client/impl/AsyncConsumerWorkService.cs index 2352f93f4c..cfefee8821 100644 --- a/projects/RabbitMQ.Client/client/impl/AsyncConsumerWorkService.cs +++ b/projects/RabbitMQ.Client/client/impl/AsyncConsumerWorkService.cs @@ -128,7 +128,7 @@ private async Task LoopWithConcurrency(CancellationToken cancellationToken) { while (await _channel.Reader.WaitToReadAsync(cancellationToken).ConfigureAwait(false)) { - while (_channel.Reader.TryRead(out Work work)) + while (_channel.Reader.TryRead(out Work work) && !cancellationToken.IsCancellationRequested) { // Do a quick synchronous check before we resort to async/await with the state-machine overhead. if (!_limiter.Wait(0))