Add total to account conn updates

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2018-12-08 18:52:04 -08:00
parent 2ab23ca307
commit 7fb2886098
2 changed files with 8 additions and 6 deletions

View File

@@ -40,7 +40,7 @@ var (
const (
// VERSION is the current version for the server.
VERSION = "2.0.0-beta.7"
VERSION = "2.0.0-beta.8"
// PROTO is the currently supported protocol.
// 0 was the original

View File

@@ -88,9 +88,10 @@ type DisconnectEventMsg struct {
// a given account when the number of connections changes. It will also HB
// updates in the absence of any changes.
type AccountNumConns struct {
Server ServerInfo `json:"server"`
Account string `json:"acc"`
Conns int `json:"conns"`
Server ServerInfo `json:"server"`
Account string `json:"acc"`
Conns int `json:"conns"`
TotalConns int `json:"total_conns"`
}
// accNumConnsReq is sent when we are starting to track an account for the first
@@ -677,8 +678,9 @@ func (s *Server) sendAccConnsUpdate(a *Account, subj string) {
// Build event with account name and number of local clients.
m := AccountNumConns{
Account: a.Name,
Conns: a.numLocalConnections(),
Account: a.Name,
Conns: a.numLocalConnections(),
TotalConns: len(s.clients),
}
a.mu.Unlock()