Fixes for race detections under GHA

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2020-06-01 18:34:18 -07:00
parent d6e72105ad
commit b5dfb984e9
2 changed files with 3 additions and 1 deletions

View File

@@ -1546,7 +1546,7 @@ func (c *client) processConnect(arg []byte) error {
}
} else if c.acc == nil {
// By default register with the global account.
c.registerWithAccount(srv.gacc)
c.registerWithAccount(srv.globalAccount())
}
}

View File

@@ -1095,6 +1095,7 @@ func (s *Server) reloadAuthorization() {
// If account exist in latest config, "transfer" the account's
// sublist and client map to the new account.
acc.mu.RLock()
newAcc.mu.Lock()
if len(acc.clients) > 0 {
newAcc.clients = make(map[*client]struct{}, len(acc.clients))
for c := range acc.clients {
@@ -1112,6 +1113,7 @@ func (s *Server) reloadAuthorization() {
newAcc.imports.rrMap[k] = v
}
}
newAcc.mu.Unlock()
acc.mu.RUnlock()
// Check if current and new config of this account are same