Skip to content

Commit 0077d2e

Browse files
RotvigPliner
authored andcommitted
Fix Argument exception is thrown on dispose of consumer dispatcher (#1096)
1 parent b9c4452 commit 0077d2e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Source/EasyNetQ/Consumer/ConsumerDispatcher.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ public ConsumerDispatcher(ConnectionConfiguration configuration)
2424
while (!cancellation.IsCancellationRequested)
2525
try
2626
{
27-
BlockingCollection<Action>.TakeFromAny(
28-
blockingCollections, out var action, cancellation.Token
29-
);
30-
action();
27+
if (BlockingCollection<Action>.TryTakeFromAny(blockingCollections, out var action, -1, cancellation.Token) >= 0)
28+
{
29+
action();
30+
}
3131
}
3232
catch (OperationCanceledException) when (cancellation.IsCancellationRequested)
3333
{

0 commit comments

Comments
 (0)