I have the following workflow:
func MyWorkflow(ctx workflow.Context,...) error {
duration := time.Until(sendAt)
timerFuture := workflow.NewTimer(ctx, duration)
selector.AddReceive(ctx.Done(), func(c workflow.ReceiveChannel, more bool) {...})
selector.AddFuture(timerFuture, func(f workflow.Future) {...})
selector.Select(ctx)
}
So selector
at the bottom will block until one of two things happen:
- ctx.Done()
- timer is due
So when I execute CancelWorkflow, it still goes inside the closure of AddFuture.
How can I make it so that on Cancel, only closure of AddReceive is executed and then finishes workflow?
Thanks