diff --git a/src/NServiceBus.Transport.Msmq/DelayedDelivery/DueDelayedMessagePoller.cs b/src/NServiceBus.Transport.Msmq/DelayedDelivery/DueDelayedMessagePoller.cs index 049cede1..3e03d962 100644 --- a/src/NServiceBus.Transport.Msmq/DelayedDelivery/DueDelayedMessagePoller.cs +++ b/src/NServiceBus.Transport.Msmq/DelayedDelivery/DueDelayedMessagePoller.cs @@ -124,9 +124,8 @@ async Task Loop(CancellationToken cancellationToken) //After waiting we cancel the token so that the task waiting for the signal is cancelled and does not "eat" the next //signal when it is raised in the next iteration of this loop using (var waitCancelled = new CancellationTokenSource()) + using (var combinedSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, waitCancelled.Token)) { - var combinedSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, waitCancelled.Token); - var waitTask = WaitIfNeeded(nextPoll.Value, combinedSource.Token); var signalTask = WaitForSignal(combinedSource.Token);