Skip to content

Commit b3ca1b3

Browse files
gioragutttargos
authored andcommitted
timers: remove redundant unref calls
PR-URL: #38320 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 769a210 commit b3ca1b3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/timers/promises.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ function setTimeout(after, value, options = {}) {
6161
}
6262
let oncancel;
6363
const ret = new Promise((resolve, reject) => {
64-
const timeout = new Timeout(resolve, after, args, false, true);
65-
if (!ref) timeout.unref();
64+
const timeout = new Timeout(resolve, after, args, false, ref);
6665
insert(timeout, timeout._idleTimeout);
6766
if (signal) {
6867
oncancel = FunctionPrototypeBind(cancelListenerHandler,
@@ -141,8 +140,7 @@ async function* setInterval(after, value, options = {}) {
141140
callback();
142141
callback = undefined;
143142
}
144-
}, after, undefined, true, true);
145-
if (!ref) interval.unref();
143+
}, after, undefined, true, ref);
146144
insert(interval, interval._idleTimeout);
147145
if (signal) {
148146
onCancel = () => {

0 commit comments

Comments
 (0)