Skip to content

Commit

Permalink
timers: remove redundant unref calls
Browse files Browse the repository at this point in the history
PR-URL: #38320
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
gioragutt authored and Trott committed Apr 24, 2021
1 parent 04ec693 commit d9b56fe
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/timers/promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 = () => {
Expand Down

0 comments on commit d9b56fe

Please sign in to comment.