From 63c6270a48b7be4cf9209bcf2df753ae805f2dd9 Mon Sep 17 00:00:00 2001 From: Giora Guttsait Date: Tue, 20 Apr 2021 23:13:59 +0300 Subject: [PATCH] timers: remove redundant unref calls --- lib/timers/promises.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/timers/promises.js b/lib/timers/promises.js index ec13e873d8443c..1f245580f86ab5 100644 --- a/lib/timers/promises.js +++ b/lib/timers/promises.js @@ -61,8 +61,7 @@ function setTimeout(after, value, options = {}) { } let oncancel; const ret = new Promise((resolve, reject) => { - const timeout = new Timeout(resolve, after, args, false, true); - if (!ref) timeout.unref(); + const timeout = new Timeout(resolve, after, args, false, ref); insert(timeout, timeout._idleTimeout); if (signal) { oncancel = FunctionPrototypeBind(cancelListenerHandler, @@ -141,8 +140,7 @@ async function* setInterval(after, value, options = {}) { callback(); callback = undefined; } - }, after, undefined, true, true); - if (!ref) interval.unref(); + }, after, undefined, true, ref); insert(interval, interval._idleTimeout); if (signal) { onCancel = () => {