Make graceful shutdown more graceful by actually waiting for sockets (and others) to close. Ongoing effort.

This commit is contained in:
Simo Kinnunen
2014-04-12 16:16:03 +09:00
parent 123bf2e647
commit bd2b43901d
4 changed files with 23 additions and 12 deletions

View File

@@ -1,6 +1,7 @@
var zmq = require('zmq')
var logger = require('../util/logger')
var lifecycle = require('../util/lifecycle')
module.exports = function(options) {
var log = logger.createLogger('triproxy')
@@ -31,4 +32,10 @@ module.exports = function(options) {
pull.bindSync(options.endpoints.pull)
pull.on('message', proxy(dealer))
log.info('PULL socket bound on', options.endpoints.pull)
lifecycle.observe(function() {
pub.close()
dealer.close()
pull.close()
})
}