Skip to content

Clarify setImmediate not always run before setTimeout at main module in the learn Asynchronous Work doc #7681

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kekekuli opened this issue Apr 24, 2025 · 2 comments

Comments

@kekekuli
Copy link
Contributor

Affected URL(s)

https://nodejs.org/en/learn/asynchronous-work/understanding-processnexttick

Description of the problem

In that doc, here is an example code to explain how the nextTick() API affect the execute order. It is right for the nextTick() part. But readers will quickly get messy when they see the output example saying that the setImmediate always have higher order than setTimeout , while both at top-level. The other doc have pointed out that behavior.

So it is better to chang the setimmediate-vs-settimeout part in the example code in that doc.

@kekekuli
Copy link
Contributor Author

Hello, @avivkeller. I have made changes based on your advise, please let me know if you'd like any adjustments!

@avivkeller
Copy link
Member

For future reference, it's much easier to review if you leave comments regarding the PR on the PR, rather than on the issue. I've responded to your PR with additional comments.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants