Merge pull request #2102 from nats-io/fix_leafnode_flapper

Fixed leafnode flapper
This commit is contained in:
Ivan Kozlovic
2021-04-12 09:59:36 -06:00
committed by GitHub

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()