@cryptotaxi247 / kubo / commits / b5cbc8b6f

dht_test: better bootstrapping logging

Juan Batiz-Benet committed Dec 23, 2014 at 22:05 UTC b5cbc8b6fa4b2c2aeaadd01e9c42b497838e6038
1 file changed +5 -3
routing/dht/dht_test.go
+5 -3
@@ -94,17 +94,19 @@ func connect(t *testing.T, ctx context.Context, a, b *IpfsDHT) {
94 func bootstrap(t *testing.T, ctx context.Context, dhts []*IpfsDHT) {
95
96 // try multiple rounds...
97 - rounds := 5
97 + rounds := 1
98 for i := 0; i < rounds; i++ {
99 fmt.Printf("bootstrapping round %d/%d\n", i, rounds)
100
101 var wg sync.WaitGroup
102 for _, dht := range dhts {
103 wg.Add(1)
104 - go func() {
104 + go func(i int) {
105 defer wg.Done()
106 + <-time.After(time.Duration(i) * time.Millisecond) // stagger them to avoid overwhelming
107 + fmt.Printf("bootstrapping round %d/%d -- %s\n", i, rounds, dht.self)
108 dht.Bootstrap(ctx)
107 - }()
109 + }(i)
110 }
111 wg.Wait()
112