Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions core/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,14 +614,6 @@ func newEnvironment(userVars map[string]string, newId uid.ID) (env *Environment,
errorMsg = e.Err.Error()
}

if e.Event == "STOP_ACTIVITY" {
// If the event is STOP_ACTIVITY, we remove the active run number after all hooks are done.
env.workflow.GetVars().Set("last_run_number", strconv.Itoa(int(env.currentRunNumber)))
env.currentRunNumber = 0
env.workflow.GetVars().Del("run_number")
env.workflow.GetVars().Del("runNumber")
}

// publish transition step complete event
the.EventWriterWithTopic(topic.Environment).WriteEvent(&pb.Ev_EnvironmentEvent{
EnvironmentId: env.id.String(),
Expand All @@ -634,6 +626,16 @@ func newEnvironment(userVars map[string]string, newId uid.ID) (env *Environment,
LastRequestUser: env.GetLastRequestUser(),
WorkflowTemplateInfo: env.GetWorkflowInfo(),
})

if e.Event == "STOP_ACTIVITY" || e.Event == "GO_ERROR" {
// If the event is STOP_ACTIVITY or GO_ERROR, we remove the active run number after all hooks are done.
if env.currentRunNumber != 0 {
env.workflow.GetVars().Set("last_run_number", strconv.Itoa(int(env.currentRunNumber)))
}
env.currentRunNumber = 0
env.workflow.GetVars().Del("run_number")
env.workflow.GetVars().Del("runNumber")
}
},
},
)
Expand Down
2 changes: 0 additions & 2 deletions core/environment/transition_startactivity.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ func (t StartActivityTransition) do(env *Environment) (err error) {
// Get a handle to the consolidated var stack of the root role of the env's workflow
if wf := env.Workflow(); wf != nil {
if cvs, cvsErr := wf.ConsolidatedVarStack(); cvsErr == nil {

// If bookkeeping is enabled and has fetched the LHC fill info, we can acquire it here
for _, key := range []string{
"fill_info_fill_number",
Expand Down Expand Up @@ -118,7 +117,6 @@ func (t StartActivityTransition) do(env *Environment) (err error) {
incomingEv := <-env.stateChangedCh
// If some tasks failed to transition
if tasksStateErrors := incomingEv.GetTasksStateChangedError(); tasksStateErrors != nil {
env.currentRunNumber = 0
return tasksStateErrors
}

Expand Down
Loading