Skip to content

Commit

Permalink
nsqd: protect channel close on topic exit
Browse files Browse the repository at this point in the history
  • Loading branch information
mreiferson committed Mar 21, 2021
1 parent adc3e0d commit ec2c44f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nsqd/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,13 +384,15 @@ func (t *Topic) exit(deleted bool) error {
}

// close all the channels
t.RLock()
for _, channel := range t.channelMap {
err := channel.Close()
if err != nil {
// we need to continue regardless of error to close all the channels
t.nsqd.logf(LOG_ERROR, "channel(%s) close - %s", channel.name, err)
}
}
t.RUnlock()

// write anything leftover to disk
t.flush()
Expand Down

0 comments on commit ec2c44f

Please sign in to comment.