Fixed leafnode flapper

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
This commit is contained in:
Ivan Kozlovic
2021-04-12 09:31:33 -06:00
parent 32734960ed
commit c369a26c03

View File

@@ -3307,16 +3307,18 @@ func TestLeafNodeNoPingBeforeConnect(t *testing.T) {
}
var leaf *client
s.grMu.Lock()
for _, l := range s.grTmpClients {
leaf = l
break
}
s.grMu.Unlock()
if leaf == nil {
t.Fatal("No leaf connection found")
}
checkFor(t, time.Second, 15*time.Millisecond, func() error {
s.grMu.Lock()
for _, l := range s.grTmpClients {
leaf = l
break
}
s.grMu.Unlock()
if leaf == nil {
return fmt.Errorf("No leaf connection found")
}
return nil
})
// Make sure that ping timer is not set
leaf.mu.Lock()