Skip to content

Commit

Permalink
[core] make sure run_end_time_ms is set after trg_end_time_ms
Browse files Browse the repository at this point in the history
  • Loading branch information
knopers8 committed Nov 24, 2023
1 parent 5cab192 commit 0719872
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions core/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,6 @@ func newEnvironment(userVars map[string]string) (env *Environment, err error) {
} else {
log.Error("cannot access AliECS workflow configuration defaults")
}
} else if e.Event == "STOP_ACTIVITY" {
endTime, ok := env.workflow.GetUserVars().Get("run_end_time_ms")
if ok && endTime == "" {
runEndTime := strconv.FormatInt(time.Now().UnixMilli(), 10)
env.workflow.SetRuntimeVar("run_end_time_ms", runEndTime)
} else {
log.WithField("partition", envId.String()).
Debug("O2 End time already set before before_STOP_ACTIVITY")
}
} else if e.Event == "GO_ERROR" {
endTime, ok := env.workflow.GetUserVars().Get("run_end_time_ms")
if ok && endTime == "" {
Expand Down Expand Up @@ -303,6 +294,15 @@ func newEnvironment(userVars map[string]string) (env *Environment, err error) {
env.currentRunNumber = 0
env.workflow.GetVars().Del("run_number")
env.workflow.GetVars().Del("runNumber")

endTime, ok := env.workflow.GetUserVars().Get("run_end_time_ms")
if ok && endTime == "" {
runEndTime := strconv.FormatInt(time.Now().UnixMilli(), 10)
env.workflow.SetRuntimeVar("run_end_time_ms", runEndTime)
} else {
log.WithField("partition", envId.String()).
Debug("O2 End time already set before after_STOP_ACTIVITY")
}
// Ensure the auto stop timer is stopped (important for stop transitions NOT triggered by the timer itself)
env.invalidateAutoStopTransition()
}
Expand Down

0 comments on commit 0719872

Please sign in to comment.