Merge pull request #1393 from nats-io/internal_client_reload

Move reset of internal client to after the account sublist was moved.
This commit is contained in:
Ivan Kozlovic
2020-05-13 14:43:30 -06:00
committed by GitHub
2 changed files with 9 additions and 2 deletions

View File

@@ -1106,8 +1106,17 @@ func (s *Server) reloadAuthorization() {
for _, route := range s.routes {
routes = append(routes, route)
}
var resetCh chan struct{}
if s.sys != nil {
// can't hold the lock as go routine reading it may be waiting for lock as well
resetCh = s.sys.resetCh
}
s.mu.Unlock()
if resetCh != nil {
resetCh <- struct{}{}
}
// Close clients that have moved accounts
for _, client := range cclients {
client.closeConnection(ClientClosed)

View File

@@ -515,8 +515,6 @@ func (s *Server) configureAccounts() error {
s.mu.Unlock()
// acquires server lock separately
s.addSystemAccountExports(acc)
// can't hold the lock as go routine reading it may be waiting for lock as well
s.sys.resetCh <- struct{}{}
s.mu.Lock()
}
if err != nil {