core: log every 5s while waiting for dependencies

Helps to flush out deadlocks in the dependency graph
This commit is contained in:
Paul Hinze 2015-08-07 14:48:13 -05:00
parent 1a44b427a7
commit 9cd88810f4
1 changed files with 15 additions and 2 deletions

View File

@ -2,9 +2,11 @@ package dag
import ( import (
"fmt" "fmt"
"log"
"sort" "sort"
"strings" "strings"
"sync" "sync"
"time"
"github.com/hashicorp/go-multierror" "github.com/hashicorp/go-multierror"
) )
@ -197,8 +199,19 @@ func (g *AcyclicGraph) Walk(cb WalkFunc) error {
readyCh := make(chan bool) readyCh := make(chan bool)
go func(v Vertex, 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 // First wait for all the dependencies
for _, ch := range chs { for i, ch := range chs {
<-ch DepSatisfied:
for {
select {
case <-ch:
break DepSatisfied
case <-time.After(time.Second * 5):
log.Printf("[DEBUG] vertex %s, waiting for: %s",
VertexName(v), VertexName(deps[i]))
}
}
log.Printf("[DEBUG] vertex %s, got dep: %s",
VertexName(v), VertexName(deps[i]))
} }
// Then, check the map to see if any of our dependencies failed // Then, check the map to see if any of our dependencies failed