Skip to content

Commit

Permalink
nsqd: Fix lost message when loading from metadata file
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelyou committed May 10, 2018
1 parent ef7fc2e commit 2bf2517
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nsqd/nsqd.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ func (n *NSQD) LoadMetadata() error {
channel.Pause()
}
}
topic.UnPause()
}
return nil
}
Expand Down Expand Up @@ -515,6 +516,10 @@ func (n *NSQD) GetTopic(topicName string) *Topic {
t = NewTopic(topicName, &context{n}, deleteCallback)
n.topicMap[topicName] = t

if atomic.LoadInt32(&n.isLoading) == 0 {
t.UnPause()
}

n.logf(LOG_INFO, "TOPIC(%s): created", t.name)

// release our global nsqd lock, and switch to a more granular topic lock while we init our
Expand Down
1 change: 1 addition & 0 deletions nsqd/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func NewTopic(topicName string, ctx *context, deleteCallback func(*Topic)) *Topi
pauseChan: make(chan bool),
deleteCallback: deleteCallback,
idFactory: NewGUIDFactory(ctx.nsqd.getOpts().ID),
paused: 1,
}

if strings.HasSuffix(topicName, "#ephemeral") {
Expand Down

0 comments on commit 2bf2517

Please sign in to comment.