timers: remove redundant unref calls

PR-URL: https://github.com/nodejs/node/pull/38320
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
pull/38320/head
Giora Guttsait 2021-04-20 23:13:59 +03:00 committed by Rich Trott
parent 04ec693a30
commit d9b56fe295
1 changed files with 2 additions and 4 deletions

View File

@ -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 = () => {