I have big workflow, it will running for hours. some activity might failed and break the retryPolicy and cause the workflow running failed
when the running failed, I need to reset the workflow to continue from the failed activity. it is easy if the flow’s activity serially. just find the failed activity and get it’s “WorkflowTaskCompletedEventId” then reset the flow. but things got wired in parallel activity workflow
a parallel flow like below,
func SimpleParallelFlow(ctx workflow.Context) error {
// ctx prepare
futures := make([]workflow.Future, 0, 2)
for index := 0; index < 2; index++ {
future, settable := workflow.NewFuture(ctx)
futures = append(futures, future)
workflow.Go(ctx, func(ctx workflow.Context) {
err := workflow.ExecuteActivity(ctx, PreCheck).Get(ctx, nil)
if err != nil {
settable.SetError(err)
return
}
err = workflow.ExecuteActivity(ctx, DoSth).Get(ctx, nil)
if err != nil {
settable.SetError(err)
return
}
})
}
// handle future
return nil
}
it simple, graph like
the problem is that, when activity “preCheck-1” failed while activity “preCheck-2” and “doSth-2” succeed. I need to reset the flow running to rerun “preCheck-1”, however I found that “preCheck-1” and “preCheck-2” has same “WorkflowTaskCompletedEventId” which means not only “preCheck-1” will be rerun but also “preCheck-2”. that’s not what i want
is there a graceful way to solve it? reset the flow and only “preCheck-1” will be rerun and nothing happen to the succeed activity “preCheck-2”