Skip to content

Commit 27114c0

Browse files
authored
Merge pull request #1086 from mamidenn/patch-1
Make QueueConsumer.Stop() idempotent
2 parents 16661ef + 7d3bbfa commit 27114c0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/WorkflowCore/Services/BackgroundTasks/QueueConsumer.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ public virtual void Start()
5353
public virtual void Stop()
5454
{
5555
_cancellationTokenSource.Cancel();
56-
DispatchTask.Wait();
57-
DispatchTask = null;
56+
if (DispatchTask != null)
57+
{
58+
DispatchTask.Wait();
59+
DispatchTask = null;
60+
}
5861
}
5962

6063
private async Task Execute()

0 commit comments

Comments
 (0)