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 <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
gioragutt authored and targos committed Apr 29, 2021
1 parent 769a210 commit b3ca1b3
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 b3ca1b3

Please sign in to comment.