From b5cbc8b6fa4b2c2aeaadd01e9c42b497838e6038 Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Tue, 23 Dec 2014 22:05:29 -0800 Subject: [PATCH] dht_test: better bootstrapping logging --- routing/dht/dht_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/routing/dht/dht_test.go b/routing/dht/dht_test.go index 3c3ce9954..d3041f364 100644 --- a/routing/dht/dht_test.go +++ b/routing/dht/dht_test.go @@ -94,17 +94,19 @@ func connect(t *testing.T, ctx context.Context, a, b *IpfsDHT) { func bootstrap(t *testing.T, ctx context.Context, dhts []*IpfsDHT) { // try multiple rounds... - rounds := 5 + rounds := 1 for i := 0; i < rounds; i++ { fmt.Printf("bootstrapping round %d/%d\n", i, rounds) var wg sync.WaitGroup for _, dht := range dhts { wg.Add(1) - go func() { + go func(i int) { defer wg.Done() + <-time.After(time.Duration(i) * time.Millisecond) // stagger them to avoid overwhelming + fmt.Printf("bootstrapping round %d/%d -- %s\n", i, rounds, dht.self) dht.Bootstrap(ctx) - }() + }(i) } wg.Wait()