From 8e5ba2533aa62e0aa5492110ba301f77095840a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulises=20Gasc=C3=B3n?= Date: Mon, 27 Jan 2020 13:37:41 +0100 Subject: [PATCH 1/2] Added missing conditional at scheduleDestroy function Related #5 --- lib/server.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/server.js b/lib/server.js index 81ca446..4e511e7 100644 --- a/lib/server.js +++ b/lib/server.js @@ -46,7 +46,9 @@ module.exports = function(options) { logger.warn(format('Forcefully stopping server on %s:%d', config.host, config.port)) server.destroy(cb) }, duration(config.shutdown.delay)) - destroy.unref() + if(destroy){ + destroy.unref() + } } function close(cb) { From 0c6d921fd598870d3b274bd2d6b92623f8760259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulises=20Gasc=C3=B3n?= Date: Mon, 27 Jan 2020 16:34:06 +0100 Subject: [PATCH 2/2] Improved validation --- lib/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/server.js b/lib/server.js index 4e511e7..ae43815 100644 --- a/lib/server.js +++ b/lib/server.js @@ -46,7 +46,7 @@ module.exports = function(options) { logger.warn(format('Forcefully stopping server on %s:%d', config.host, config.port)) server.destroy(cb) }, duration(config.shutdown.delay)) - if(destroy){ + if(destroy instanceof Object){ destroy.unref() } }