Skip to content

Documentation: performance warning about timeout.unref() is not clear. #42239

Closed
@cakoose

Description

@cakoose

Affected URL(s)

https://nodejs.org/api/timers.html#timeoutunref

Description of the problem

The documentation for timeout.unref() ends with this warning:

Calling timeout.unref() creates an internal timer that will wake the Node.js event loop. Creating too many of these can adversely impact performance of the Node.js application.

I don't understand what this means.

"creates an internal timer that will wake the Node.js event loop" sounds roughly like what setTimeout does. Is it different?

Tangent: I also noticed that the docs for the new timersPromises.setInterval (link) supports the ref parameter but there's no similar warning there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.timersIssues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions