Skip to content

Commit

Permalink
Improved Engine.StartAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
kbilsted committed Oct 25, 2023
1 parent 6b42c77 commit 8cdabed
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Product/GreenFeetWorkFlow/WorkflowEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,14 @@ public async Task StartAsync(
string? engineName = null,
CancellationToken? stoppingToken = null)
{
await Task.Run(() => Start(configuration, engineName, stoppingToken));
Init(configuration, engineName);

var token = stoppingToken ?? CancellationToken.None;

var tasks = Workers!.Select(w => w.StartAsync(token));
await Task.WhenAll(tasks.ToArray());
}


/// <summary> Start the engine with the current thread as the worker. Also use this if you have trouble debugging weird scenarios </summary>
public async Task StartAsSingleWorker(
WorkflowConfiguration configuration,
Expand Down

0 comments on commit 8cdabed

Please sign in to comment.