From c42335af434c617411620e3ff3b11a40ecdf1790 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Thu, 16 Jul 2015 18:33:54 -0700 Subject: [PATCH] unref timer --- lib/websocket-tracker.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/websocket-tracker.js b/lib/websocket-tracker.js index 249786f..b5233b4 100644 --- a/lib/websocket-tracker.js +++ b/lib/websocket-tracker.js @@ -233,10 +233,13 @@ WebSocketTracker.prototype._onSocketError = function (err) { WebSocketTracker.prototype._startReconnectTimer = function () { var self = this var ms = Math.floor(Math.random() * RECONNECT_VARIANCE) + RECONNECT_MINIMUM - setTimeout(function () { + + var reconnectTimer = setTimeout(function () { self.destroyed = false self._openSocket() }, ms) + if (reconnectTimer.unref) reconnectTimer.unref() + debug('reconnecting socket in %s ms', ms) }