Hello,
I have a workflow like the following one that starts some work in parallel using workflow.Go
.
doneCount := 0
for range 5 {
workflow.Go(ctx, func(innerCtx workflow.Context) {
defer func() { doneCount++ }()
// do some work here, e.g. execute a child workflow.
})
}
workflow.Await(ctx, func() bool {
return doneCount == 5
})
When cancelling this workflow, the call to workflow.Await
unblocks without waiting for the running coroutines to finish. For example, a child workflow inside the workflow.Go
gets terminated.
Would using a disconnected context for the workflow.Await
call result in waiting until all coroutines have completed? Is that good practice/allowed?
Thanks already for having a look.
cheers,
Daniel