Skip to content

Commit

Permalink
Fix Argument exception is thrown on dispose of consumer dispatcher (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Rotvig committed Aug 10, 2020
1 parent 4268063 commit e3ce0ba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Source/EasyNetQ/Consumer/ConsumerDispatcher.cs
Expand Up @@ -26,10 +26,10 @@ public ConsumerDispatcher()
while (!cancellation.IsCancellationRequested)
try
{
BlockingCollection<Action>.TakeFromAny(
blockingCollections, out var action, cancellation.Token
);
action();
if (BlockingCollection<Action>.TryTakeFromAny(blockingCollections, out var action, -1, cancellation.Token) >= 0)
{
action();
}
}
catch (OperationCanceledException) when (cancellation.IsCancellationRequested)
{
Expand Down

0 comments on commit e3ce0ba

Please sign in to comment.