Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: dag errors should cascade to all descendents #2963

Merged
merged 1 commit into from
Aug 7, 2015
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
5 changes: 3 additions & 2 deletions dag/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func (g *AcyclicGraph) Walk(cb WalkFunc) error {

// Start the goroutine to wait for our dependencies
readyCh := make(chan bool)
go func(deps []Vertex, chs []<-chan struct{}, readyCh chan<- bool) {
go func(v Vertex, deps []Vertex, chs []<-chan struct{}, readyCh chan<- bool) {
// First wait for all the dependencies
for _, ch := range chs {
<-ch
Expand All @@ -206,13 +206,14 @@ func (g *AcyclicGraph) Walk(cb WalkFunc) error {
defer errLock.Unlock()
for _, dep := range deps {
if errMap[dep] {
errMap[v] = true
readyCh <- false
return
}
}

readyCh <- true
}(deps, depChs, readyCh)
}(v, deps, depChs, readyCh)

// Start the goroutine that executes
go func(v Vertex, doneCh chan<- struct{}, readyCh <-chan bool) {
Expand Down
4 changes: 3 additions & 1 deletion dag/dag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,10 @@ func TestAcyclicGraphWalk_error(t *testing.T) {
g.Add(1)
g.Add(2)
g.Add(3)
g.Add(4)
g.Connect(BasicEdge(4, 3))
g.Connect(BasicEdge(3, 2))
g.Connect(BasicEdge(3, 1))
g.Connect(BasicEdge(2, 1))

var visits []Vertex
var lock sync.Mutex
Expand Down