From e17ab9cd8f28ff9cce3e2d4f9c1d719c2a69d164 Mon Sep 17 00:00:00 2001 From: James Greenleaf Date: Wed, 23 Oct 2019 14:44:20 -0400 Subject: [PATCH] Add conditional to timer.unref --- src/common/connection.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/connection.ts b/src/common/connection.ts index 76662644..51473f1a 100644 --- a/src/common/connection.ts +++ b/src/common/connection.ts @@ -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) }) }