diff --git a/nsqd/channel.go b/nsqd/channel.go index e6eba0cf8..af20cfc50 100644 --- a/nsqd/channel.go +++ b/nsqd/channel.go @@ -200,8 +200,15 @@ func (c *Channel) Empty() error { client.Empty() } + clientMsgChan := c.clientMsgChan for { select { + case _, ok := <-clientMsgChan: + if !ok { + // c.clientMsgChan may be closed while in this loop + // so just remove it from the select so we can make progress + clientMsgChan = nil + } case <-c.memoryMsgChan: default: goto finish diff --git a/nsqd/topic.go b/nsqd/topic.go index 4fa2a953d..9a571cb19 100644 --- a/nsqd/topic.go +++ b/nsqd/topic.go @@ -184,7 +184,7 @@ func (t *Topic) messagePump() { continue } case <-t.channelUpdateChan: - chans = chans[:0] + chans = make([]*Channel, 0) t.RLock() for _, c := range t.channelMap { chans = append(chans, c)