Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions server/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -3149,7 +3149,6 @@ 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.
Expand Down Expand Up @@ -3308,7 +3307,16 @@ func (mset *stream) setupMirrorConsumer() error {

// Wait for previous processMirrorMsgs go routine to be completely done.
// If none is running, this will not block.
mirrorWg.Wait()
mset.mu.Lock()
if mset.mirror == nil {
// Mirror config has been removed.
mset.mu.Unlock()
return
} else {
wg := &mset.mirror.wg
mset.mu.Unlock()
wg.Wait()
}

select {
case ccr := <-respCh:
Expand Down