From 1749b0b362a1e3c2cd3f65330ac6bcbf373062d6 Mon Sep 17 00:00:00 2001 From: Rowan Seymour Date: Tue, 3 Mar 2020 12:02:02 -0500 Subject: [PATCH] Fix resuming when child has errored --- flows/engine/session.go | 10 +++++----- flows/runs/run.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/flows/engine/session.go b/flows/engine/session.go index ea6b5cfb4..b35c81e10 100644 --- a/flows/engine/session.go +++ b/flows/engine/session.go @@ -313,13 +313,13 @@ func (s *session) continueUntilWait(sprint flows.Sprint, currentRun flows.FlowRu childRun := currentRun currentRun = parentRun + // can't resume into a run with a missing flow + if currentRun.Flow() == nil { + return errors.New("can't resume parent run with missing flow asset") + } + // as long as we didn't error, we can try to resume it if childRun.Status() != flows.RunStatusFailed { - // if flow for this run is a missing asset, we have a problem - if currentRun.Flow() == nil { - return errors.New("can't resume parent run with missing flow asset") - } - if destination, err = s.findResumeDestination(sprint, currentRun, false); err != nil { failure(sprint, currentRun, step, errors.Wrapf(err, "can't resume run as node no longer exists")) } diff --git a/flows/runs/run.go b/flows/runs/run.go index 15a234e07..43e5723f0 100644 --- a/flows/runs/run.go +++ b/flows/runs/run.go @@ -172,11 +172,11 @@ func (r *flowRun) CreateStep(node flows.Node) flows.Step { } func (r *flowRun) PathLocation() (flows.Step, flows.Node, error) { - if r.Path() == nil { + if len(r.path) == 0 { return nil, nil, errors.Errorf("run has no location as path is empty") } - step := r.Path()[len(r.Path())-1] + step := r.path[len(r.path)-1] // check that we still have a node for this step node := r.Flow().GetNode(step.NodeUUID())