Skip to content

Commit

Permalink
nsqd: start goroutines after opening all listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
mreiferson committed Mar 28, 2015
1 parent 3ef4a65 commit 5606c5c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions nsqd/nsqd.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ func NewNSQD(opts *nsqdOptions) *NSQD {
}
n.tlsConfig = tlsConfig

n.waitGroup.Wrap(func() { n.idPump() })

n.logf(version.String("nsqd"))
n.logf("ID: %d", n.opts.ID)

Expand Down Expand Up @@ -175,8 +173,6 @@ func (n *NSQD) Main() {

ctx := &context{n}

n.waitGroup.Wrap(func() { n.lookupLoop() })

tcpListener, err := net.Listen("tcp", n.opts.TCPAddress)
if err != nil {
n.logf("FATAL: listen (%s) failed - %s", n.opts.TCPAddress, err)
Expand Down Expand Up @@ -225,6 +221,8 @@ func (n *NSQD) Main() {
http_api.Serve(n.httpListener, httpServer, n.opts.Logger, "HTTP")
})

n.waitGroup.Wrap(func() { n.idPump() })
n.waitGroup.Wrap(func() { n.lookupLoop() })
if n.opts.StatsdAddress != "" {
n.waitGroup.Wrap(func() { n.statsdLoop() })
}
Expand Down

0 comments on commit 5606c5c

Please sign in to comment.