diff --git a/server/server.go b/server/server.go index e39d5952..30b8f04c 100644 --- a/server/server.go +++ b/server/server.go @@ -1236,6 +1236,7 @@ func (s *Server) registerAccountNoLock(acc *Account) *Account { // Finish account setup and store. s.setAccountSublist(acc) + acc.mu.Lock() if acc.clients == nil { acc.clients = make(map[*client]struct{}) } @@ -1245,7 +1246,6 @@ func (s *Server) registerAccountNoLock(acc *Account) *Account { // During config reload, it is possible that account was // already created (global account), so use locking and // make sure we create only if needed. - acc.mu.Lock() // TODO(dlc)- Double check that we need this for GWs. if acc.rm == nil && s.opts != nil && s.shouldTrackSubscriptions() { acc.rm = make(map[string]int32)