Add conditional to timer.unref

This commit is contained in:
James Greenleaf
2019-10-23 14:44:20 -04:00
parent edc15b8727
commit e17ab9cd8f

View File

@@ -456,7 +456,7 @@ class Connection extends EventEmitter {
this._whenReady(this._send(message)).then(() => {
const delay = timeout || this._timeout
timer = setTimeout(() => _reject(new TimeoutError()), delay)
timer.unref()
if (timer.unref) timer.unref()
}).catch(_reject)
})
}