diff --git a/server/stream.go b/server/stream.go index a3588dd844d..bff2643d46f 100644 --- a/server/stream.go +++ b/server/stream.go @@ -3143,6 +3143,7 @@ func (mset *stream) setupMirrorConsumer() error { } mirror := mset.mirror + mirrorWg := &mirror.wg // We want to throttle here in terms of how fast we request new consumers, // or if the previous is still in progress. @@ -3301,7 +3302,7 @@ func (mset *stream) setupMirrorConsumer() error { // Wait for previous processMirrorMsgs go routine to be completely done. // If none is running, this will not block. - mirror.wg.Wait() + mirrorWg.Wait() select { case ccr := <-respCh: