Fix for debugSubscribers and claims test

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2023-04-04 14:36:16 -07:00
parent 3551c7b2bf
commit b14a400df6
2 changed files with 21 additions and 2 deletions

View File

@@ -2266,8 +2266,26 @@ func (s *Server) debugSubscribers(sub *subscription, c *client, _ *Account, subj
return return
} }
_, acc, _, msg, err := s.getRequestInfo(c, msg) var ci ClientInfo
if err != nil { if len(hdr) > 0 {
if err := json.Unmarshal(getHeader(ClientInfoHdr, hdr), &ci); err != nil {
return
}
}
var acc *Account
if ci.Service != _EMPTY_ {
acc, _ = s.LookupAccount(ci.Service)
} else if ci.Account != _EMPTY_ {
acc, _ = s.LookupAccount(ci.Account)
} else {
// Direct $SYS access.
acc = c.acc
if acc == nil {
acc = s.SystemAccount()
}
}
if acc == nil {
return return
} }

View File

@@ -1220,6 +1220,7 @@ func TestAccountClaimsUpdates(t *testing.T) {
claimUpdateSubj := fmt.Sprintf(subj, pub) claimUpdateSubj := fmt.Sprintf(subj, pub)
nc.Publish(claimUpdateSubj, []byte(ajwt)) nc.Publish(claimUpdateSubj, []byte(ajwt))
nc.Flush() nc.Flush()
time.Sleep(200 * time.Millisecond)
acc, _ = s.LookupAccount(pub) acc, _ = s.LookupAccount(pub)
if acc.MaxActiveConnections() != 8 { if acc.MaxActiveConnections() != 8 {