Skip to content

Commit

Permalink
Merge pull request #1015 from ricado-group/fixAsyncConsumerSemaphoreD…
Browse files Browse the repository at this point in the history
…ispose

Fix Semaphore Disposed Exception in AsyncConsumerWorkService
  • Loading branch information
michaelklishin authored Feb 5, 2021
2 parents d39bb71 + 08854f1 commit cff0c3d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit cff0c3d

Please sign in to comment.