unref timer

This commit is contained in:
Feross Aboukhadijeh 2015-07-16 18:33:54 -07:00
parent 5b79d42dcd
commit c42335af43

View File

@ -233,10 +233,13 @@ WebSocketTracker.prototype._onSocketError = function (err) {
WebSocketTracker.prototype._startReconnectTimer = function () { WebSocketTracker.prototype._startReconnectTimer = function () {
var self = this var self = this
var ms = Math.floor(Math.random() * RECONNECT_VARIANCE) + RECONNECT_MINIMUM var ms = Math.floor(Math.random() * RECONNECT_VARIANCE) + RECONNECT_MINIMUM
setTimeout(function () {
var reconnectTimer = setTimeout(function () {
self.destroyed = false self.destroyed = false
self._openSocket() self._openSocket()
}, ms) }, ms)
if (reconnectTimer.unref) reconnectTimer.unref()
debug('reconnecting socket in %s ms', ms) debug('reconnecting socket in %s ms', ms)
} }