Skip to content

Commit

Permalink
Delay set http server to allow listeners in the promise chain will ge…
Browse files Browse the repository at this point in the history
…t the `server` event.
  • Loading branch information
lsm committed Oct 28, 2015
1 parent a9d9f09 commit f7cf7f7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ Service.prototype.startWebServer = function(port, host) {
self.announcement.webPort = address.port
debug('[%s] web server started at %s:%s', self.name, address.address, address.port)

self.setHttpServer(server)
// Make sure listeners in `init()` could get this event.
process.nextTick(function() {
self.setHttpServer(server)
})
}
})
}
Expand Down

0 comments on commit f7cf7f7

Please sign in to comment.