Fix data race

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2023-04-06 10:37:31 -07:00
parent 7547093b24
commit dee5229f9b

View File

@@ -890,10 +890,17 @@ func (s *Server) sendAPIErrResponse(ci *ClientInfo, acc *Account, subject, reply
const errRespDelay = 500 * time.Millisecond
func (s *Server) sendDelayedAPIErrResponse(ci *ClientInfo, acc *Account, subject, reply, request, response string, rg *raftGroup) {
js := s.getJetStream()
if js == nil {
return
}
var quitCh <-chan struct{}
js.mu.RLock()
if rg != nil && rg.node != nil {
quitCh = rg.node.QuitC()
}
js.mu.RUnlock()
s.startGoRoutine(func() {
defer s.grWG.Done()
select {