[CHANGED] Move Gateway interest-only mode switch from INF to DBG

Also fixed a test that would sometimes fail depending on timing.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
This commit is contained in:
Ivan Kozlovic
2021-03-14 11:33:45 -06:00
parent 45f2df2bb2
commit cbcff97244
3 changed files with 10 additions and 8 deletions

View File

@@ -1603,7 +1603,7 @@ func TestSystemAccountWithGateways(t *testing.T) {
defer ncb.Close()
// space for .CONNECT and .CONNS from SYS and $G as well as one extra message
msgs := [3]*nats.Msg{}
msgs := [4]*nats.Msg{}
var err error
msgs[0], err = sub.NextMsg(time.Second)
require_NoError(t, err)
@@ -1611,8 +1611,10 @@ func TestSystemAccountWithGateways(t *testing.T) {
require_NoError(t, err)
msgs[2], err = sub.NextMsg(time.Second)
require_NoError(t, err)
_, err = sub.NextMsg(250 * time.Millisecond) // rule out extra messages
require_Error(t, err)
// TODO: There is a race currently that can cause the server to process the
// system event *after* the subscription on "A" has been registered, and so
// the "nca" client would receive its own CONNECT message.
msgs[3], _ = sub.NextMsg(250 * time.Millisecond)
findMsgs := func(sub string) []*nats.Msg {
rMsgs := []*nats.Msg{}

View File

@@ -2887,7 +2887,7 @@ func (c *client) gatewayAllSubsReceiveStart(info *Info) {
return
}
c.Noticef("Gateway %q: switching account %q to %s mode",
c.Debugf("Gateway %q: switching account %q to %s mode",
info.Gateway, account, InterestOnly)
// Since the remote would send us this start command
@@ -2932,7 +2932,7 @@ func (c *client) gatewayAllSubsReceiveComplete(info *Info) {
e.mode = InterestOnly
e.Unlock()
c.Noticef("Gateway %q: switching account %q to %s mode complete",
c.Debugf("Gateway %q: switching account %q to %s mode complete",
info.Gateway, account, InterestOnly)
}
}
@@ -2967,7 +2967,7 @@ func (c *client) gatewaySwitchAccountToSendAllSubs(e *insie, accName string) {
s := c.srv
remoteGWName := c.gw.name
c.Noticef("Gateway %q: switching account %q to %s mode",
c.Debugf("Gateway %q: switching account %q to %s mode",
remoteGWName, accName, InterestOnly)
// Function that will create an INFO protocol
@@ -3009,7 +3009,7 @@ func (c *client) gatewaySwitchAccountToSendAllSubs(e *insie, accName string) {
// matching sub from us.
sendCmd(gatewayCmdAllSubsComplete, true)
c.Noticef("Gateway %q: switching account %q to %s mode complete",
c.Debugf("Gateway %q: switching account %q to %s mode complete",
remoteGWName, accName, InterestOnly)
})
}

View File

@@ -5725,7 +5725,7 @@ type captureGWInterestSwitchLogger struct {
imss []string
}
func (l *captureGWInterestSwitchLogger) Noticef(format string, args ...interface{}) {
func (l *captureGWInterestSwitchLogger) Debugf(format string, args ...interface{}) {
l.Lock()
msg := fmt.Sprintf(format, args...)
if strings.Contains(msg, fmt.Sprintf("switching account %q to %s mode", globalAccountName, InterestOnly)) ||