Skip to content

Commit 9532a48

Browse files
author
Michal Tichák
committed
[core] reset currentRunNumber in GO_ERROR instead of transition_startactivity
1 parent 7a1243b commit 9532a48

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

core/environment/environment.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -614,14 +614,6 @@ func newEnvironment(userVars map[string]string, newId uid.ID) (env *Environment,
614614
errorMsg = e.Err.Error()
615615
}
616616

617-
if e.Event == "STOP_ACTIVITY" {
618-
// If the event is STOP_ACTIVITY, we remove the active run number after all hooks are done.
619-
env.workflow.GetVars().Set("last_run_number", strconv.Itoa(int(env.currentRunNumber)))
620-
env.currentRunNumber = 0
621-
env.workflow.GetVars().Del("run_number")
622-
env.workflow.GetVars().Del("runNumber")
623-
}
624-
625617
// publish transition step complete event
626618
the.EventWriterWithTopic(topic.Environment).WriteEvent(&pb.Ev_EnvironmentEvent{
627619
EnvironmentId: env.id.String(),
@@ -634,6 +626,16 @@ func newEnvironment(userVars map[string]string, newId uid.ID) (env *Environment,
634626
LastRequestUser: env.GetLastRequestUser(),
635627
WorkflowTemplateInfo: env.GetWorkflowInfo(),
636628
})
629+
630+
if e.Event == "STOP_ACTIVITY" || e.Event == "GO_ERROR" {
631+
// If the event is STOP_ACTIVITY or GO_ERROR, we remove the active run number after all hooks are done.
632+
if env.currentRunNumber != 0 {
633+
env.workflow.GetVars().Set("last_run_number", strconv.Itoa(int(env.currentRunNumber)))
634+
}
635+
env.currentRunNumber = 0
636+
env.workflow.GetVars().Del("run_number")
637+
env.workflow.GetVars().Del("runNumber")
638+
}
637639
},
638640
},
639641
)

core/environment/transition_startactivity.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ func (t StartActivityTransition) do(env *Environment) (err error) {
8181
// Get a handle to the consolidated var stack of the root role of the env's workflow
8282
if wf := env.Workflow(); wf != nil {
8383
if cvs, cvsErr := wf.ConsolidatedVarStack(); cvsErr == nil {
84-
8584
// If bookkeeping is enabled and has fetched the LHC fill info, we can acquire it here
8685
for _, key := range []string{
8786
"fill_info_fill_number",
@@ -118,7 +117,6 @@ func (t StartActivityTransition) do(env *Environment) (err error) {
118117
incomingEv := <-env.stateChangedCh
119118
// If some tasks failed to transition
120119
if tasksStateErrors := incomingEv.GetTasksStateChangedError(); tasksStateErrors != nil {
121-
env.currentRunNumber = 0
122120
return tasksStateErrors
123121
}
124122

0 commit comments

Comments
 (0)