760
761
getNextEventIDBranchToken := func(runID string) (nextEventID int64, branchToken []byte, retError error) {
763
>
var err error
764
>
765
>
// currentWorkflow is nil when resetting a workflow with no current run; load every run from the cache.
766
>
if currentWorkflow != nil && runID == currentWorkflow.GetMutableState().GetWorkflowKey().RunID {
767
wfCtx = currentWorkflow.GetContext()
769
>
var release historyi.ReleaseWorkflowContextFunc
770
>
wfCtx, release, err = r.workflowCache.GetOrCreateWorkflowExecution(
771
>
ctx,
772
>
r.shardContext,
773
>
namespaceID,
774
>
&commonpb.WorkflowExecution{
775
>
WorkflowId: workflowID,
776
>
RunId: runID,
777
>
},
778
>
locks.PriorityHigh,
779
>
)
780
>
if err != nil {
781
return 0, nil, err
782
}
784
}
785
787
>
if err != nil {
788
// no matter what error happen, we need to retry
789
return 0, nil, err