mirror of
https://github.com/fluencelabs/go-libp2p-kad-dht
synced 2025-07-02 06:01:38 +00:00
defer dialqueue action until initial peers have been added.
This commit is contained in:
@ -42,6 +42,8 @@ func TestDialQueueGrowsOnSlowDials(t *testing.T) {
|
||||
t.Error("unexpected error when constructing the dial queue", err)
|
||||
}
|
||||
|
||||
dq.Start()
|
||||
|
||||
for i := 0; i < 4; i++ {
|
||||
_ = dq.Consume()
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
@ -86,6 +88,8 @@ func TestDialQueueShrinksWithNoConsumers(t *testing.T) {
|
||||
t.Error("unexpected error when constructing the dial queue", err)
|
||||
}
|
||||
|
||||
dq.Start()
|
||||
|
||||
// acquire 3 consumers, everytime we acquire a consumer, we will grow the pool because no dial job is completed
|
||||
// and immediately returnable.
|
||||
for i := 0; i < 3; i++ {
|
||||
@ -158,6 +162,8 @@ func TestDialQueueShrinksWithWhenIdle(t *testing.T) {
|
||||
t.Error("unexpected error when constructing the dial queue", err)
|
||||
}
|
||||
|
||||
dq.Start()
|
||||
|
||||
// keep up to speed with backlog by releasing the dial function every time we acquire a channel.
|
||||
for i := 0; i < 13; i++ {
|
||||
ch := dq.Consume()
|
||||
@ -210,6 +216,8 @@ func TestDialQueueMutePeriodHonored(t *testing.T) {
|
||||
t.Error("unexpected error when constructing the dial queue", err)
|
||||
}
|
||||
|
||||
dq.Start()
|
||||
|
||||
// pick up three consumers.
|
||||
for i := 0; i < 3; i++ {
|
||||
_ = dq.Consume()
|
||||
|
Reference in New Issue
Block a user