Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Mar 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions server/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1603,16 +1603,18 @@ 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)
msgs[1], err = sub.NextMsg(time.Second)
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{}
Expand Down
8 changes: 4 additions & 4 deletions server/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
})
}
Expand Down
2 changes: 1 addition & 1 deletion server/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)) ||
Expand Down