Skip to content

Commit 3bae41c

Browse files
committed
Fix Argument exception is thrown on dispose of client dispatcher
1 parent 70d54b1 commit 3bae41c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Source/EasyNetQ/Producer/ClientCommandDispatcherSingleton.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ private void StartDispatcherThread(ConnectionConfiguration configuration)
101101
{
102102
try
103103
{
104-
var channelAction = queue.Take(cancellation.Token);
105-
channelAction();
104+
if (queue.TryTake(out var channelAction, -1, cancellation.Token))
105+
channelAction();
106106
}
107107
catch (OperationCanceledException) when (cancellation.IsCancellationRequested)
108108
{

0 commit comments

Comments
 (0)