mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
@@ -56,6 +56,7 @@ const (
|
||||
connsRespSubj = "$SYS._INBOX_.%s"
|
||||
accConnsEventSubjNew = "$SYS.ACCOUNT.%s.SERVER.CONNS"
|
||||
accConnsEventSubjOld = "$SYS.SERVER.ACCOUNT.%s.CONNS" // kept for backward compatibility
|
||||
lameDuckEventSubj = "$SYS.SERVER.%s.LAMEDUCK"
|
||||
shutdownEventSubj = "$SYS.SERVER.%s.SHUTDOWN"
|
||||
authErrorEventSubj = "$SYS.SERVER.%s.CLIENT.AUTH.ERR"
|
||||
serverStatsSubj = "$SYS.SERVER.%s.STATSZ"
|
||||
@@ -541,7 +542,7 @@ func (s *Server) sendLDMShutdownEventLocked() {
|
||||
if s.sys == nil || s.sys.sendq == nil {
|
||||
return
|
||||
}
|
||||
subj := fmt.Sprintf(shutdownEventSubj, s.info.ID)
|
||||
subj := fmt.Sprintf(lameDuckEventSubj, s.info.ID)
|
||||
si := &ServerInfo{}
|
||||
s.sys.sendq.push(newPubMsg(nil, subj, _EMPTY_, si, nil, si, noCompression, false, true))
|
||||
}
|
||||
@@ -957,6 +958,13 @@ func (s *Server) initEventTracking() {
|
||||
if _, err := s.sysSubscribe(subject, s.noInlineCallback(s.remoteServerShutdown)); err != nil {
|
||||
s.Errorf("Error setting up internal tracking: %v", err)
|
||||
}
|
||||
// Listen for servers entering lame-duck mode.
|
||||
// NOTE: This currently is handled in the same way as a server shutdown, but has
|
||||
// a different subject in case we need to handle differently in future.
|
||||
subject = fmt.Sprintf(lameDuckEventSubj, "*")
|
||||
if _, err := s.sysSubscribe(subject, s.noInlineCallback(s.remoteServerShutdown)); err != nil {
|
||||
s.Errorf("Error setting up internal tracking: %v", err)
|
||||
}
|
||||
// Listen for account claims updates.
|
||||
subscribeToUpdate := true
|
||||
if s.accResolver != nil {
|
||||
|
||||
@@ -1666,7 +1666,7 @@ func TestSystemAccountWithGateways(t *testing.T) {
|
||||
|
||||
// If this tests fails with wrong number after 10 seconds we may have
|
||||
// added a new inititial subscription for the eventing system.
|
||||
checkExpectedSubs(t, 45, sa)
|
||||
checkExpectedSubs(t, 46, sa)
|
||||
|
||||
// Create a client on B and see if we receive the event
|
||||
urlb := fmt.Sprintf("nats://%s:%d", ob.Host, ob.Port)
|
||||
|
||||
@@ -3942,7 +3942,7 @@ func TestMonitorAccountz(t *testing.T) {
|
||||
body = string(readBody(t, fmt.Sprintf("http://127.0.0.1:%d%s?acc=$SYS", s.MonitorAddr().Port, AccountzPath)))
|
||||
require_Contains(t, body, `"account_detail": {`)
|
||||
require_Contains(t, body, `"account_name": "$SYS",`)
|
||||
require_Contains(t, body, `"subscriptions": 40,`)
|
||||
require_Contains(t, body, `"subscriptions": 41,`)
|
||||
require_Contains(t, body, `"is_system": true,`)
|
||||
require_Contains(t, body, `"system_account": "$SYS"`)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user