From e5dbb214a2ae60b19dfd3399c2fc8413df003000 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Sat, 11 Mar 2017 09:20:15 -0500 Subject: [PATCH] pgraph: Move the BackPoke to before the semaphores I can't think of a reason we should grab a semaphore before backpoking. The semaphore is intended to block around the actual work in CheckApply, not the dependency resolution of the correct vertex. --- pgraph/actions.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pgraph/actions.go b/pgraph/actions.go index ab82f85c..37903436 100644 --- a/pgraph/actions.go +++ b/pgraph/actions.go @@ -169,6 +169,18 @@ func (g *Graph) Process(v *Vertex) error { defer obj.SetState(resources.ResStateNil) // reset state when finished obj.SetState(resources.ResStateProcess) + // is it okay to run dependency wise right now? + // if not, that's okay because when the dependency runs, it will poke + // us back and we will run if needed then! + if !g.OKTimestamp(v) { + go g.BackPoke(v) + return nil + } + // timestamp must be okay... + if g.Flags.Debug { + log.Printf("%s[%s]: OKTimestamp(%v)", obj.Kind(), obj.GetName(), v.GetTimestamp()) + } + // semaphores! // These shouldn't ever block an exit, since the graph should eventually // converge causing their them to unlock. More interestingly, since they @@ -191,18 +203,6 @@ func (g *Graph) Process(v *Vertex) error { var ok = true var applied = false // did we run an apply? - // is it okay to run dependency wise right now? - // if not, that's okay because when the dependency runs, it will poke - // us back and we will run if needed then! - if !g.OKTimestamp(v) { - go g.BackPoke(v) - return nil - } - // timestamp must be okay... - - if g.Flags.Debug { - log.Printf("%s[%s]: OKTimestamp(%v)", obj.Kind(), obj.GetName(), v.GetTimestamp()) - } // connect any senders to receivers and detect if values changed if updated, err := obj.SendRecv(obj); err != nil {