Repository navigation
Documentation: performance warning about timeout.unref() is not clear. #42239
Copy link
Copy link
Closed
Labels
docIssues and PRs related to Node.js documentation.Issues and PRs related to Node.js documentation.timersIssues and PRs related to timers, setImmediate(), setInterval(), and setTimeout().Issues and PRs related to timers, setImmediate(), setInterval(), and setTimeout().
Description
Activity
- addeddocIssues and PRs related to Node.js documentation.Issues and PRs related to Node.js documentation.
on Mar 7, 2022 @nodejs/timers
It had been added for a long time: bdd1a74
Maybe we need to check its current status.I checked the code in v0.9.1, there is indeed a
new Timerprocess:Lines 254 to 267 in e6ce259
Timeout.prototype.unref = function() { if (!this._handle) { var delay = this._when - Date.now(); if (delay < 0) delay = 0; exports.unenroll(this); this._handle = new Timer(); this._handle.ontimeout = this._onTimeout; this._handle.start(delay, 0); this._handle.domain = this.domain; this._handle.unref(); } else { this._handle.unref(); } }; But this is not the case now.
Reacted by Kannan Goundan- addedtimersIssues and PRs related to timers, setImmediate(), setInterval(), and setTimeout().Issues and PRs related to timers, setImmediate(), setInterval(), and setTimeout().
on Mar 8, 2022 - added a commit that references this issue
on Mar 10, 2022 - added a commit that references this issue
on Mar 21, 2022 - added 4 commits that reference this issue
on Apr 21, 2022 - added a commit that references this issue
on Apr 25, 2022
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to Node.js documentation.Issues and PRs related to Node.js documentation.timersIssues and PRs related to timers, setImmediate(), setInterval(), and setTimeout().Issues and PRs related to timers, setImmediate(), setInterval(), and setTimeout().
Affected URL(s)
https://nodejs.org/api/timers.html#timeoutunref
Description of the problem
The documentation for
timeout.unref()ends with this warning:I don't understand what this means.
"creates an internal timer that will wake the Node.js event loop" sounds roughly like what
setTimeoutdoes. Is it different?Tangent: I also noticed that the docs for the new
timersPromises.setInterval(link) supports therefparameter but there's no similar warning there.