Skip to content

Commit

Permalink
Fix: regression of nsqio#891. ephemeral channel race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
slayercat committed Apr 14, 2020
1 parent 8db8c50 commit 8a49026
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nsqd/protocol_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,10 @@ func (p *protocolV2) SUB(client *clientV2, params [][]byte) ([]byte, error) {
for {
topic := p.ctx.nsqd.GetTopic(topicName)
channel = topic.GetChannel(channelName)
if channel.Exiting() || topic.Exiting() {
time.Sleep(1 * time.Millisecond)
continue
}
if err := channel.AddClient(client.ID, client); err != nil {
return nil, protocol.NewFatalClientErr(nil, "E_TOO_MANY_CHANNEL_CONSUMERS",
fmt.Sprintf("channel consumers for %s:%s exceeds limit of %d",
Expand Down

0 comments on commit 8a49026

Please sign in to comment.