diff --git a/nsqd/protocol_v2.go b/nsqd/protocol_v2.go index 02ba0dac3..89e167506 100644 --- a/nsqd/protocol_v2.go +++ b/nsqd/protocol_v2.go @@ -616,7 +616,15 @@ func (p *protocolV2) SUB(client *clientV2, params [][]byte) ([]byte, error) { } topic := p.ctx.nsqd.GetTopic(topicName) + for topic.Exiting() { + time.Sleep(1 * time.Microsecond) + topic = p.ctx.nsqd.GetTopic(topicName) + } channel := topic.GetChannel(channelName) + for channel.Exiting() { + time.Sleep(1 * time.Microsecond) + channel = topic.GetChannel(channelName) + } channel.AddClient(client.ID, client) atomic.StoreInt32(&client.State, stateSubscribed)