X Tutup
The Wayback Machine - https://web.archive.org/web/20230103052616/https://github.com/nodejs/node/pull/45093
Skip to content
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

doc: fix process.nextTick() scheduling differences between module types #45093

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dnalborczyk
Copy link
Contributor

@dnalborczyk dnalborczyk commented Oct 20, 2022

fixes #45048

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. process Issues and PRs related to the process subsystem. labels Oct 20, 2022
@@ -2515,7 +2515,8 @@ The [`queueMicrotask()`][] API is an alternative to `process.nextTick()` that
also defers execution of a function using the same microtask queue used to
execute the then, catch, and finally handlers of resolved promises. Within
Node.js, every time the "next tick queue" is drained, the microtask queue
is drained immediately after.
is drained immediately after. Note that `process.nextTick()` is scheduled
Copy link
Member

@devsnek devsnek Oct 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

process.nextTick is not scheduled differently, the module's execution is scheduled differently (specifically, it is a microtask). I think we should be careful of our wording here so people don't get confused.

@theanarkh
Copy link
Contributor

theanarkh commented Oct 28, 2022

I think it is because the mjs module is loaded by promise, so after Node.js execute the code of mjs module, it will handle the microtask(except for tasks created by nextTick) created by mjs module. But the js module is loaded synchronously, so it is different. Is it right ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. process Issues and PRs related to the process subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong example
4 participants
X Tutup